Test-and-Test-and-Set Spinlock - Quant Developer Interview Question
Difficulty: Medium
Category: concurrency
Practice quant interview questions from top firms including Jane Street, Citadel, Two Sigma, DE Shaw, and other leading quantitative finance companies.
Topics: concurrency, atomic, low-latency, c++17
Problem Description
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
Practice this medium developer interview question on MyntBit - the all-in-one quant learning platform with 200+ quant interview questions for Jane Street, Citadel, Two Sigma, and other top quantitative finance firms.