Skip to content

Shared memory

What the ordering arguments buy

Acquire, release, and why every synchronising primitive in this course is really the same two ideas.

10 minutes · acquire · release · happens-before edges

Two halves of one idea

A **release** publishes: everything the thread did before it becomes visible to whoever picks the object up. An **acquire** takes delivery: the thread now knows everything the last releaser knew. Neither does anything on its own; together they create one happens-before edge, and that edge is the entire mechanism.

Every synchronising operation in this course is one, the other, or both. Unlocking is a release and locking is an acquire — which is why a mutex orders everything, not just the field it guards. Sending on a channel releases, receiving acquires. A thread ending releases, a join acquires. A compare-and-swap does both at once, which is what makes it usable as the whole of a synchronisation strategy.

That is also why the fixes in this course score the way they do. Adding a lock adds an edge, and adds it between every pair of operations either side of it, which is why it works and why it costs so much concurrency. An atomic publish adds exactly the edge that was missing and nothing else, and the scoring reflects the difference.

Everything you do here stays in this browser.