What this C++ memory-order interview question tests
This is an easy concurrency question that probes your understanding of memory ordering semantics in C++. It appears frequently in interviews at firms where lock-free programming or thread-safe data structures matter—including trading systems and infrastructure teams.
The question asks you to reason about how atomic operations with different memory-order guarantees interact across threads. Specifically, you'll need to understand the visibility and ordering constraints imposed by each memory order (relaxed, release-acquire, sequential consistency), and how they affect which values can be observed when multiple threads read and write concurrently.
- Acquire-release semantics and synchronization
- Sequential consistency vs. relaxed atomics
- Happens-before relationships between threads
- Compiler and hardware reordering under different memory models