Last active
May 5, 2020 18:49
-
-
Save soerenmartius/e8acb5832cf5f5badf1f5c5ad7a79c7e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Process | Thread | |
---|---|---|
Processes are heavy-weight operations. | Threads are lighter-weight operations. | |
Processes can start new processes using e.g. [fork()](http://man7.org/linux/man-pages/man2/fork.2.html) (system call). | A process can start several threads using e.g [pthread_create()](http://man7.org/linux/man-pages/man3/pthread_create.3.html) (system call). | |
Each process lives in its own memory (address) space and holds a full copy of the program in memory which consume more memory. Processes don’t share memory with other processes. | Threads share memory with other threads of the same process. Threads within the same process live within the same address space and can thus easily access each other's data structures. The shared memory heaps and pools allow for reduced overhead of shared components. | |
Inter-process communication is slow as processes have different memory addresses. | Inter-thread communication can be faster than inter-process communication because threads of the same process share memory with the process they belong to. | |
Context switching between processes is more expensive. | Context switching between threads of the same process is less expensive. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment