liveBook · Manning

Acquire-release semantics

Acquire-release semantics are memory-ordering rules under which release operations make preceding effects visible to acquire operations that synchronize with them.

How 4 Manning books explain it

C++ Concurrency in Action, Second Edition

Acquire-release ordering provides synchronization when an acquire operation reads a value written by a release operation, without imposing a single global order.

How it is used
Coordinates visibility of writes between threads without requiring sequential consistency.
How deep it goes
Works through matching release and acquire operations, their ordering of relaxed writes, transitive synchronization, and the absence of total order.
Examples
Uses two atomic flags, a release-published relaxed write, and a three-thread synchronization chain.
What you can do after
Apply it via std::atomic release stores and acquire loads to publish earlier writes between threads.

Read how C++ Concurrency in Action, Second Edition explains acquire-release semantics →

Modern C

A release operation is a concurrency operation that publishes preceding effects so that a corresponding acquire can observe them.

How it is used
Establishes visibility of one thread’s earlier effects to another through paired synchronization operations.
How deep it goes
Defines the synchronization rule and visibility consequence, then identifies atomic memory orders and library pairs without developing implementation internals.
Examples
Uses an input/account-thread exchange, call_once initialization, and atomic_fetch_add_explicit with memory_order_acq_rel.
What you can do after
Apply it via C atomic _explicit interfaces or paired library calls to make preceding effects visible across threads.

Read how Modern C explains acquire-release semantics →

Modern C, Third Edition

Release semantics are memory-ordering properties that make preceding effects available to a thread that synchronizes with the release operation.

How it is used
Establishes when effects in one thread become visible to another through atomic operations or C library synchronization.
How deep it goes
Defines directional operations and the read-from synchronization rule, then states its visibility consequence; defers relaxed atomic operations.
Examples
Uses two threads exchanging an atomic value and a table of C library release-acquire pairs.
What you can do after
Evaluate/understand whether an atomic read or mutex acquisition makes another thread’s preceding effects visible.

Read how Modern C, Third Edition explains acquire-release semantics →

C# Concurrency: Asynchronous and multithreaded programming

Release semantics are memory-ordering guarantees that prevent writes from being moved later than a synchronization operation.

How it is used
Protects visibility of shared-data updates when a thread releases a lock.
How deep it goes
Defines write-ordering guarantees and relates them to locks, acquire operations, memory barriers, and the memory model.
Examples
Uses lock release and Figure 7.1 to illustrate writes becoming available to the next thread.
What you can do after
Apply it by locking shared-data access so released changes become visible to the next thread.

Read how C# Concurrency: Asynchronous and multithreaded programming explains acquire-release semantics →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.