What is the difference between a process and a thread?
- One sentence each.
- Then the one that matters today: what do two threads of the same program share that two processes do not?
- A process is a running program with its own memory. A thread is one line of execution inside a process.
- Threads of one program share the same objects on the heap. Processes do not.
- That sharing is the whole reason threads are fast — and the whole reason today's bug exists.