Thread
(thread) is a single sequence of control flow in a "process". Also called lightweight processes. Computer science term referring to the scheduling unit of a running program.
Thread, sometimes called a lightweight process (LWP), is the smallest unit of program execution flow. A standard thread consists of a thread ID, a current instruction pointer (PC), a register set and a stack. In addition, a thread is an entity in the process and is the basic unit that is independently scheduled and dispatched by the system. The thread itself does not own system resources, only some resources that are essential for operation, but it can communicate with other threads that belong to the same process. Share all resources owned by the process. A thread can create and destroy another thread, and multiple threads in the same process can execute concurrently. Due to the mutual constraints between threads, threads show discontinuity in their operation. Threads also have three basic states: ready, blocked and running. Every program has at least one thread. If a program has only one thread, it is the program itself.
To put it simply, each of your CPU cores is a thread. AMD's CPU has as many threads as there are cores.
For example, AMD Athlon II process!
For example, the I5 3450 has 4 cores and 4 threads. The high-end I7 supports hyper-threading technology. The i7 3970X has 6 cores and 12 processes.
Function:
The above is the detailed content of What is the role of threads. For more information, please follow other related articles on the PHP Chinese website!