Introduction
- A thread is the smallest unit that the operating system can perform operation scheduling. It is included in the process and is the actual operating unit in the process. A thread refers to a single sequential control flow in a process. A process can have multiple threads concurrently, and each thread executes different tasks in parallel.
- An instance of a program execution is a process
- All threads in the same process share the same memory space, so multiple threads in the same process can communicate directly; and the memory of the process is independent, so if two processes want to communicate, they must go through an intermediate agent. accomplish
- Creating a new thread is simple, creating a new process requires a clone of its parent process
- A thread can control and operate other threads in the same process, but a process can only operate child processes