liveBook · Manning

Read-modify-write operation

An operation that reads a value from a location, computes or selects an update, and writes the resulting value back to that location.

How 3 Manning books explain it

C++ Concurrency in Action, Second Edition

A read-modify-write operation atomically reads a value, modifies it, and writes the result as one operation.

How it is used
Uses atomic read-modify-write operations to update shared values and support synchronization in concurrent data structures.
How deep it goes
Explains return values, compare-exchange failures, release sequences, and cache contention through concrete C++ cases.
Examples
Uses atomic booleans, pointer arithmetic, a reference-counted lock-free stack, and a contended atomic counter.
What you can do after
Evaluate atomic updates by tracing their values, synchronization effects, and possible contention costs.

Read how C++ Concurrency in Action, Second Edition explains read-modify-write operation →

Modern C

A read-modify-write operation atomically reads an object, computes or applies a modification, and writes the resulting value as one indivisible operation.

How it is used
Coordinates atomic updates between threads while controlling visibility and synchronization through memory-order semantics.
How deep it goes
Distinguishes operation categories and explains explicit memory-order choices, but does not develop their platform-level implementation.
Examples
Uses atomic_fetch_add_explicit on an atomic counter and lists exchange, compare-exchange, compound assignment, increment, decrement, and atomic-flag forms.
What you can do after
Apply it via atomic_fetch_add_explicit or compare-exchange interfaces with an explicitly selected memory_order value.

Read how Modern C explains read-modify-write operation →

Modern C, Third Edition

A read-modify-write operation atomically reads an object, computes or selects a new value, and writes that value as one indivisible operation.

How it is used
Coordinates concurrent access by making selected atomic updates indivisible and usable for synchronization.
How deep it goes
Defines recognized forms and synchronization behavior, but stops short of implementation-level mechanics.
Examples
Uses atomic increment and decrement alongside separate reads and writes of an atomic unsigned object.
What you can do after
Evaluate/understand which atomic expressions combine reading and writing, and how those expressions synchronize between threads.

Read how Modern C, Third Edition explains read-modify-write operation →

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.