ContentsThe library

Doing Two Things at Once

Everybody Holding, Nobody Moving

Last timeWhat Waiting Actually Costs

If 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.

Two workers need the same two things. One takes the first and reaches for the

second. The other takes the second and reaches for the first. Both now wait for

as long as the system runs.

It is the most famous failure in the subject and the most completely solved. The

theory is four sentences long and the remedy is usually a document.

It needs four things at once

A permanent mutual wait needs all four of the following at the same moment.

FIG 1A cycle of four, each holding what the next one needs
The ring is what makes this permanent rather than merely slow. Every other kind of waiting ends when somebody finishes, and here nobody can finish, because finishing requires something that only a blocked worker can release.

The four conditions are exclusive access, so that a lock cannot be shared;

holding while waiting, so that a worker keeps what it has while it asks for more;

no taking back, so that a lock cannot be removed from its holder; and a cycle in

who is waiting for whom. Remove any one and the ring cannot close.

The lesson stops here

8 more paragraphs to go

You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.

The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.

See the planThe contents

This is the reading half

Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.

The contents

The rest of this course

  1. 01The Update That Vanished
  2. 02A Door That Admits Oneopening only
  3. 03The Bill Arrives as Latencyopening only
  4. 04Everybody Holding, Nobody Movingyou are here
  5. 05Try, Check, Try Againopening only
  6. 06The Promise Is Weaker Than You Thinkopening only
  7. 07The Ceiling You Cannot Buyopening only
  8. 08The Problem You Decide Not to Haveopening only

Read alongside