Process vs thread.
A process is a kitchen; threads are the cooks working inside it.
- My kitchen, my rules.1
Each process is its own walled-off kitchen, with its own private supplies.
- Two of us on this order.2
Inside one kitchen, threads are the cooks actually doing the work.
- 3
They share the same counter and shelves, so handing work back and forth is quick.
- I had it first!4
But two cooks reaching for the same pot at once is where it goes wrong (a race).
- Wait for the token.5
So they take turns: a lock means only one cook touches the shared pot at a time.
- 6
Separate kitchens are safe but heavy; cooks in one kitchen are fast but need care.
Semicolony semicolony.dev/eli5/process-vs-thread/comic