What is the difference between a process and a thread? And concurrency vs parallelism?
Short answer
A process is a running program with its own memory, isolated by the OS; a thread is a path of execution inside a process, sharing the heap but with its own stack. Concurrency is many tasks making progress together, parallelism is many tasks truly running at the same time on several cores.
3 points to say:
- Process: own memory, isolated, talks via IPC; thread: shared heap, own stack, cheap communication but needs synchronization.
- A platform thread maps 1:1 to an OS thread (~1 MB stack); a context switch between threads is cheaper than between processes but not free.
- Concurrency is structure (can interleave on one core); parallelism is simultaneous execution and needs several cores.
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.