CSOS & ConcurrencyDiagramBeginner
Process vs Thread
KO: 프로세스 vs 스레드·EN: Process vs Thread·JA: プロセス vs スレッド
Comparing Processes (isolated memory and resource containers) against Threads (lightweight execution units sharing a process's heap)
Table of Contents
Structure Diagram
Process vs Thread Execution Unit Comparison
PROCESSProcess
Isolated virtual memory · Fault isolation
- Memory SpaceFully isolated Code, Data, Heap & Stack
- CommunicationIPC required (pipes, sockets, shm)
- OverheadHigh (page table switch & TLB flush)
- StabilityCrash stays isolated to one process
THREADThread
Lightweight execution unit · Shared Heap
- Memory SpaceOwn Stack & registers; shared Heap & Code
- CommunicationDirect shared memory (sync locks needed)
- OverheadLow (same virtual address space)
- StabilityRace conditions; one crash can kill process
Quick Answer
What is Process vs Thread?
Comparing Processes (isolated memory and resource containers) against Threads (lightweight execution units sharing a process's heap). It is a core concept in OS & Concurrency within CS.
Core Principles
In an operating system, a Process is a running program instance owning an isolated virtual address space, file descriptors, and permissions. A Thread is the smallest unit of CPU execution inside a process.
- Shared vs Private Memory: Threads within the same process share Code, Data, and Heap, while keeping private Stacks and CPU registers (including the instruction pointer).
- Isolation vs Speed: Processes provide strong fault and security isolation at higher creation/switching cost; threads switch cheaply and share state directly but demand careful synchronization.
Practical Takeaways
- Choose multi-process for fault isolation: Browsers (Chrome) isolate tabs and plugins in separate processes so one crash or exploit cannot compromise other tabs.
- Choose multi-threading for shared-memory parallelism: Game engines and JVM/C++ servers use thread pools to saturate CPU cores while synchronizing shared structures.
- Check runtime constraints: In CPython, the GIL blocks parallel CPU-bound Python threads, making
multiprocessingnecessary for CPU parallelism.
Notable Examples
- Web Browsers (Chrome/Firefox): Separate processes for UI, tabs, GPU, and networking.
- Web Servers: Nginx multi-process event loops vs Tomcat/JVM worker thread pools.
- Green Threads: Go goroutines and Java Virtual Threads multiplexing thousands of tasks onto OS threads.