Caffeinated Coder
Book an appointment
Lesson 26 · How programs really run

Threads and concurrency

One program can do several things at once by running threads: separate paths of work that share the same memory. Watch two threads take turns on one core and run side by side on two, then step through the classic bug where both add 1 to a shared counter and one update vanishes. Fix it with a lock, see how two locks can freeze a program in a deadlock, and learn what CPython's GIL changes.

12 min12 steps5 questionsIntermediate
Fig 26 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.