Part 0 · Start

Chapter 0: Why concurrency is hard

Why a program that is correct one step at a time can be wrong when steps overlap, and the vocabulary the rest of the course builds on.

8 sections · about 20 minutes to read · Go 1.25.2

  1. A counter that is sometimes wrongOne line of code, two goroutines, and an update that disappears.2 min
  2. Break itRun the lost update in a simulator you control.3 min
  3. The idea: steps, orders and shared dataInterleavings, data races and why testing alone misses them.3 min
  4. In GoThe same bug on real goroutines, and Go's race detector.3 min
  5. In the wildWhat the Go, Python and Rust projects say about data races.4 min
  6. Other languagesThe same counter in C++ and Python, run and measured.2 min
  7. PitfallsThree ways to convince yourself the bug is not there.1 min
  8. Check yourselfQuestions, an exercise, and what comes next.2 min