Skip to content

Latest commit

 

History

History
17 lines (15 loc) · 884 Bytes

processes_vs_threads.md

File metadata and controls

17 lines (15 loc) · 884 Bytes

Processes versus Threads:

Processes

Precisely speaking, processes are also called heavyweight processes. A process is simply a program in execution. Every process has its own address, space, data stack and auxiliary data to keep track of execution. Processes can spawn other processes, but again, each process has its own data. In general, it's difficult to communicate between different process, unless interprocess communication is employed.

Threads

Threads are simply lightweight processes that share the same context and run in parallel with the main process (which is sometimes also called the main thread). Each thread has an instruction pointer which keeps track of where within its context the thread is running. Threads within a process share the same data space, so it's easier for them to communicate with each other than if they were separate processes.