The library

The systems around the model

Be able to explain why shared state breaks when two things run at the same time, what a lock buys and what it costs, how to avoid waiting in a circle, what a transaction actually promises, why adding workers stops helping, and how to design the sharing away

Doing Two Things at Once

Two pieces of work running at the same time will quietly corrupt anything they share. Every remedy is a trade between correctness, waiting, and how far the thing will scale.

8 lessons, written and corrected before you arrived. Reading them here needs no account. The first reads the whole way through; the others open and then stop, because a page nobody owns cannot tell who is reading it. Starting the course gives you your own copy, where every idea has problems standing under it and you can ask about any sentence.

Start reading

  1. 01The Update That VanishedAdding a counter looks like one action and is three. Two workers doing it at the same time can both read the same value, and one of the two additions disappears with nothing broken.
  2. 02A Door That Admits Oneopening onlyThe standard remedy is to mark a region of work and allow only one worker inside it at a time. That buys correctness, and it buys it by making every other worker wait.
  3. 03The Bill Arrives as Latencyopening onlyWaiting at a lock does not grow smoothly with load. It is flat for a long time and then rises without limit, and the first thing to break is the slowest few percent of requests.
  4. 04Everybody Holding, Nobody Movingopening onlyIf two workers take the same two locks in opposite orders, they can each end up holding what the other needs. Nothing times out, nothing errors, and both wait forever.
  5. 05Try, Check, Try Againopening onlyInstead of a door that admits one, the machine offers an indivisible change-if-unchanged operation. Build on it and nobody waits, but somebody has to repeat their work.
  6. 06The Promise Is Weaker Than You Thinkopening onlyA transaction promises all or nothing, and that nobody sees your half-finished work. The second promise is a dial, and the default setting is not the strongest one.
  7. 07The Ceiling You Cannot Buyopening onlyWhatever share of the work cannot be done at the same time sets a hard limit on how much faster the whole job can get, no matter how many workers you add.
  8. 08The Problem You Decide Not to Haveopening onlyEvery technique in this course manages a shared piece of state. The cheapest option is to arrange that nothing is shared, and to pay the costs that choice brings instead.