๐Ÿงต C++ Concurrency and Parallelism
Home Chapters Examples Diagrams Bibliography GitHub โ†—
  1. Home
  2. Shared State and Synchronization
Part 2 5 chapters

Shared State and Synchronization

The futex underneath a lock, mutual exclusion, coordination primitives, the memory model, and lock-free structures.

Doc 5

Shared State and the Futex

What a mutex actually is underneath the standard library: the futex syscall, and the cost difference between an uncontended and a contended lock.

15 minRead โ†’
Doc 6

Mutual Exclusion and Locking

The mutex family, the RAII lock wrapper types, and the lock-ordering discipline that avoids deadlock.

15 minRead โ†’
Doc 7

Coordination Primitives

condition_variable, C++20's latch and barrier, and counting_semaphore, and how to choose among them.

12 minRead โ†’
Doc 8

Atomics and the Memory Model

std::atomic, the C++ memory model's ordering options, fences, and the real performance cost of stricter ordering.

16 minRead โ†’
Doc 9

Lock-Free Data Structures

Single- and multi-producer/consumer ring buffers, the ABA problem, hazard pointers, RCU, and C++26's standardized reclamation support.

16 minRead โ†’
โ† Previous part Foundations Next part โ†’ Tasks, Futures, and Asynchrony
C++ Concurrency and Parallelism
Tutorial content: CC BY 4.0. Sample code: Apache 2.0.
Source on GitHub โ†—  ยท  File an issue โ†—