What this C++11 thread-safety interview question tests
This is a medium-difficulty concurrency question that probes whether you understand the practical trade-offs between different synchronization primitives in C++11. Firms ask it to separate candidates who have shipped multi-threaded code from those who have only read about it.
The question rewards clear thinking about the semantics of locks, atomics, and message-passing, and an honest assessment of which tool fits which problem. Interviewers are less interested in memorizing API names than in your ability to reason about data ownership, access patterns, and the cost of coordination.
- Mutex-based locking and critical sections
- Atomic variables and memory ordering
- Lock-free data structures and their correctness requirements
- Designing for minimal contention