What is the difference between threads and processes?

Process: It is the basic unit that allocates and manages resources during the execution of concurrently executed programs. It is a dynamic concept that competes for the basic unit of computer systems.
Thread: is an execution unit of a process, and is a schedulable entity within a process. A basic unit that runs independently than a process. Threads are also called lightweight processes.

The difference between process and thread

Address space: Threads of the same process share the address space of this process, and there is an independent address space between processes.
Resource ownership: Threads within the same process share the resources of this process such as memory, I / O, CPU, etc., but the resources between processes are independent.
Execution process: Each independent process has a program running entry, sequential execution sequence and program entry. However, threads cannot be executed independently, and must be stored in the application program, and the application program provides execution control of multiple threads.
Threads are the basic unit of processor scheduling, but processes are not. Both can be executed concurrently.

 

Published 203 original articles · praised 8 · 10,000+ views

Guess you like

Origin blog.csdn.net/z591102/article/details/105533320