liveBook · Manning

Mutable shared state

Mutable shared state is data or computational state that multiple components or execution contexts can access and whose value can change over time.

How 2 Manning books explain it

C++ Concurrency in Action, Second Edition

Shared mutable data is information accessible by multiple threads that can also be modified during execution.

How it is used
Coordinates access to data shared between threads and highlights the rules needed to avoid concurrency bugs.
How deep it goes
Explains mutex protection, encapsulation, and pointer or reference backdoors through a shared-list example.
Examples
Uses an apartment-sharing analogy and a shared std::list<int> protected during list operations.
What you can do after
Apply std::mutex and std::lock_guard to guard shared-list operations, while designing interfaces that do not leak pointers or references.

Read how C++ Concurrency in Action, Second Edition explains mutable shared state →

100 Go Mistakes and How to Avoid Them

Mutable shared state is data that can be modified and is accessible by multiple parts of a program or concurrent executions.

How it is used
Controls time-dependent cache trimming in tests by making the current time replaceable.
How deep it goes
Explains how a global clock couples tests, then contrasts struct-level clock injection with caller-supplied timestamps.
Examples
Uses a cache that trims timestamped events, a global clock variable, and a fixed-time test dependency.
What you can do after
Apply clock injection or caller-supplied cutoffs to make time-dependent tests deterministic and isolated.

Read how 100 Go Mistakes and How to Avoid Them explains mutable shared state →

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.