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