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
Uses acquire-release semantics to reason about visibility and ordering of effects across threads.
How deep it goes
Defines synchronization and visibility rules, then relates explicit memory orders to operation restrictions and consistency trade-offs.
Examples
Uses an atomic decrement observing a write, an explicit atomic increment, and shared error-log initialization.
What you can do after
Apply it via C’s explicit atomic interfaces and library synchronization pairs, with careful memory-order selection.

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
Uses synchronization to reason about cross-thread timing and visibility of effects.
How deep it goes
Explains synchronization and visibility rules for atomics and library calls, while setting aside memory_order_consume and dependency-ordered before.
Examples
Uses two threads modifying an atomic x and critical sections protected by a mutex.
What you can do after
Evaluate and understand when effects become visible across synchronized threads and why condition-variable signaling needs care.

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 →

What to know first

Related concepts

Questions about acquire-release semantics

What is 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.

Which Manning books explain acquire-release semantics?

C++ Concurrency in Action, Second Edition, Modern C, Modern C, Third Edition and C# Concurrency: Asynchronous and multithreaded programming.

What should I know before learning acquire-release semantics?

Manning books that teach acquire-release semantics usually introduce locking first.

What is the difference between acquire-release semantics and memory_order_relaxed?

Acquire-release semantics are memory-ordering rules under which release operations make preceding effects visible to acquire operations that synchronize with them. memory_order_relaxed is an atomic memory-ordering mode that preserves atomicity and each atomic object's modification order without imposing additional synchronization or ordering on other memory operations.

What is acquire-release semantics a kind of?

Acquire-release semantics is a kind of memory_order. memory_order is the C atomic-memory-order enumeration type whose values specify the synchronization semantics of atomic operations.

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.