Skip to content
BytePatterns

Concurrency

Threads, locks and races — watch the interleavings that bite.

Concurrency progress0 / 15
  1. Threads vs ProcessesShared memory, or a wall between you.4m
  2. Race ConditionsTwo readers, one write survives.5m
  3. Locks and MutexesOne thread inside, everybody else waits.5m
  4. DeadlockEveryone holding what the next one needs.5m
  5. Thread PoolsHire the workers once, reuse them all day.4m
  6. Producer and ConsumerA bounded belt between the two sides.5m
  7. Async and the Event LoopOne thread, politely taking turns.5m
  8. Atomic OperationsIndivisible: nobody sees it half-done.4m
  9. SemaphoresCount the permits, not the holders.4m
  10. Designing Thread-Safe CodeDon't share, freeze it, or guard it.5m
  11. BackpressureAn unbounded queue is not a buffer, it is a delayed crash.5m
  12. Detecting DeadlockDraw who waits for whom; a closed ring is the proof.5m
  13. Sizing a Thread PoolMore threads stop helping the moment the work stops waiting.5m
  14. Blocking the Event LoopOne thread runs everything, so one rude call stops the world.5m
  15. Compare-and-SwapPublish the new value only if nobody changed the old one.5m

Quiz yourself: 3 questions from this module

1 / 3

Two threads in one process share: