The race gallery
Every named bug in the course, reproducible in one click. Each one comes with the exact schedule that does it, so you can step through it in both directions rather than take anyone’s word for it.
Check then act
A condition is tested, and by the time it is acted on somebody else has made it false.
Lost update
Two readers of the same value each write back a result computed from what they read.
Unawaited work
Work is started and not waited for, so it lands after the thing that depended on it.
- The promise nobody waited forlesson
Cancellation that does not cancel
A cancellation is observed before the operation starts and never again, so the work completes anyway.
- The cancellation that arrives too latelesson
Unbounded concurrency
Everything is started at once because nothing was ever told how many at once is too many.
- Every request at oncelesson
Data race
Two threads touch the same location, one of them writes, and nothing in the program puts the two in an order.
- A flag, and somebody reading itlesson
Lock ordering
Two threads take the same two locks in different orders and each waits for the other.
- Two locks, two orderslesson
Condition variables
Waking from a wait is treated as proof that the thing waited for is there.
- Woken, but not readylesson
Atomics and compare-and-swap
A read-modify-write done in one indivisible step, and what happens when the swap is not retried.
- Increment without a locklesson
Linearizability
Whether a concurrent data structure behaves as though each of its operations happened at one instant inside its own window.
- A counter that returns what it didlesson
The ABA problem
A compare-and-swap succeeds because the value is the one it saw, and the value is not the thing it saw.
- The value that came backlesson
The memory model
What a machine is allowed to do with unsynchronised accesses, which is more than any interleaving of them describes.
- Each writes, then reads the otherlesson
Unsafe publication
A reference becomes visible before the thing it refers to is finished being built.
- Checked once, then checked againlesson