9 parts · 13 chapters

Concurrency and Parallelism

Concurrency is about dealing with many things at once; parallelism is about doing many things at once (Rob Pike). Every backend is concurrent; some are parallel; most concurrency bugs come from shared mutable state touched without coordination.

Nine parts: races; locks and condition variables; deadlock; lock-free basics; memory models across languages; async/await underneath; actors and CSP; Amdahl's law and parallel speedup; and one problem (a concurrent rate-limited fetcher) solved in Node, Go, Rust, Java and Python.

races · locks and condition variables · deadlock · lock-free basics · memory models · async/await underneath · actors and CSP · Amdahl · one problem in five languageseveryone without a CS degree · backend engineers in any language
hazardsRaces, deadlock, livelock, starvation and priority inversion.
primitivesMutexes, condition variables, semaphores, atomics, channels.
memory modelsHappens-before, visibility, and what each language guarantees.
asyncFutures, promises, state machines and executors under async/await.
modelsShared memory, actors and CSP, and when each fits.
scalingAmdahl and Gustafson, contention, and measuring speedup.
Built on OS and ComputersOS part 3 introduced synchronisation; Computers part 8 measured atomics and false sharing; Node part 6 covered workers. Distributed Systems is concurrency across machines.