liveBook · Manning

Acquire semantics

Also called acquire operation, memory_order_acquire

Acquire semantics prevent subsequent memory operations from being reordered before an acquire operation and make visible effects that happen-before it, including those published by a synchronizing release operation.

How 5 Manning books explain it

C++ Concurrency in Action, Second Edition

An acquire operation is an atomic operation whose ordering can synchronize with a release operation on the same memory location.

How it is used
Orders access to protected data after locking and to published stack nodes before reading their fields.
How deep it goes
Works through happens-before chains for non-atomic data in a spinlock and ordering choices across stack compare-exchanges.
Examples
Uses an atomic_flag spinlock and a reference-counted lock-free stack with differently ordered successful and failed exchanges.
What you can do after
Apply it via std::atomic_flag or compare_exchange_strong to establish ordering before reading protected or published data.

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

Modern C

An acquire operation is a concurrency operation that establishes visibility of effects published by a corresponding release.

How it is used
Establishes visibility of effects across threads through an acquiring side of synchronization.
How deep it goes
Explains the read-from condition and happens-before consequences, then distinguishes explicit memory orders and operation restrictions.
Examples
Uses an atomic decrement following a write and a call_once error-log initialization to trace visibility.
What you can do after
Apply it via C atomic operations and thread synchronization calls to reason about cross-thread visibility.

Read how Modern C explains acquire semantics →

Modern C, Third Edition

Acquire semantics are memory-ordering properties that make effects preceding a matching release operation visible after the acquire operation.

How it is used
Establishes visibility of effects across threads through atomic operations and synchronizing library calls.
How deep it goes
Defines synchronization and visibility, then illustrates library pairs; defers relaxed atomic operations.
Examples
Uses an atomic decrement reading a released value and call_once initialization of a logging stream.
What you can do after
Evaluate/understand when a matching acquire makes earlier effects visible across threads.

Read how Modern C, Third Edition explains acquire semantics →

Latency

An acquire memory barrier prevents subsequent memory operations from being reordered before a synchronization operation and observes effects published by a releasing operation.

How it is used
Establishes visibility between threads without full mutual exclusion in wait-free synchronization.
How deep it goes
Explains barrier ordering and visibility through a worked Rust example and queue implementation, without detailing architecture-specific instructions.
Examples
Uses a completion flag and shared value, then a bounded single-producer, single-consumer queue.
What you can do after
Apply it via Rust atomic ordering to publish an update and consume it after observing a release.

Read how Latency explains acquire semantics →

C# Concurrency: Asynchronous and multithreaded programming

Acquire semantics are memory-ordering guarantees that prevent reads from being moved earlier than a synchronization operation.

How it is used
Uses lock acquisition to make shared-memory reads safe against compiler and CPU reordering.
How deep it goes
Defines read-order constraints, contrasts release and barrier semantics, and stops short of detailed CPU-level implementation.
Examples
Uses shared initialization, lock acquisition and release, volatile access, and a diagram of reordered memory operations.
What you can do after
Apply lock-based synchronization when accessing data shared between threads.

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

What to know first

Related concepts

Questions about acquire semantics

What is acquire semantics?

Acquire semantics prevent subsequent memory operations from being reordered before an acquire operation and make visible effects that happen-before it, including those published by a synchronizing release operation.

Which Manning books explain acquire semantics?

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

What should I know before learning acquire semantics?

Manning books that teach acquire semantics usually introduce locking first.

What is the difference between acquire semantics and memory_order_relaxed?

Acquire semantics prevent subsequent memory operations from being reordered before an acquire operation and make visible effects that happen-before it, including those published by a synchronizing release operation. 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 semantics also called?

Acquire semantics is also called acquire operation or memory_order_acquire.

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.