1. The process is the basic unit of the system resource allocation, has the independent memory address space, the thread is the basic unit of CPU dispatch, there is no individual address space, there are independent stacks, local variables, registers, program counters and so on.
2. The cost of creating a process is large, including the creation of virtual address space, which requires a lot of system resources; the creation of thread overhead is small and basically only one kernel object and one stack.
3. One process cannot directly access the resources of another process, and multiple threads within the same process share the resources of the process.
4. High process switching overhead, low thread switching overhead, high inter-process communication overhead, and low inter-thread communication overhead.
5. Threads belong to a process and cannot be executed independently. Each process must have at least one thread, which becomes the main path.
What is a thread? What is the difference between a thread and a process?