上QQ阅读APP看书,第一时间看更新
Processes vs Threads
Processes are full programs.They have their own PID (process ID) and PEB (Process Environment Block).These are the main features of processes:
- Processes can contain multiple threads.
- If a process terminates, the associated threads do as well.
Threads are a concept similar to processes: they are also code in execution. However, the threads are executed within a process, and the threads of the process share resources among themselves, such as memory. These are the main features of threads:
- Threads can only be associated with one Process.
- Processes can continue after threads terminate (as long as there is at least one thread left).