About this question
Medium · concurrency · Quant Developer interview question · concurrency, atomic, low-latency, c++17
Minimizing bus contention is critical for reducing latency when multiple cores contend for the same resource. The Test-and-Test-and-Set (TTAS) spinlock optimizes standard spinlocks by spinning on a locally cached copy of the lock variable, only attempting an expensive atomic operation when the lock appears free. This pattern significantly reduces coherence traffic on the CPU interconnect compared to a naive Test-and-Set approach. Task Implement the TTASSpinlock class in C++ to provide thread-sa