Concurrency
$ cat /proc/threads/syllabus
9 posts
- 01 Two Threads, One Counter
Why counter += 1 isn't safe with threads, explained with bytecode and an interactive simulation.
- 02 Deadlock at the Dinner Table
Four philosophers, four forks, and a deadlock. Understanding circular waits with an interactive simulation.
- 03 The Bounded Buffer
Producers, consumers, and the queue between them. Condition variables and semaphores explained with an interactive simulation.
- 04 One Writer, Many Readers
Read-write locks let threads share data safely. Multiple readers at once, but writers get exclusive access. Understanding fairness, starvation, and when to use them.
- 05 The Thread Pool
Why creating a thread per task is expensive, how thread pools reuse workers, and what happens when the queue fills up.
- 06 async/await Under the Hood
How Python's event loop runs concurrent code on a single thread. Coroutines, await points, and why blocking calls break everything.
- 07 The Web Crawler
The classic concurrency interview problem: crawling the web with threads, queues, and rate limiting.
- 08 Actors and Message Passing
No shared state, no locks, no races. How the actor model sidesteps concurrency's hardest problems.
- 09 Memory Models and Happens-Before
When Thread 1 writes x = 1, Thread 2 might not see it. Not a bug. The hardware makes no promises.