Lock-free SPSC ring buffer

Lock-free SPSC ring buffer: the queue under every trading system

A single-producer/single-consumer ring buffer is the fastest way to move data between two threads — and the canonical low-latency interview question. We build one in C++, prove it correct with acquire/release ordering, and then watch a textbook false-sharing ‘fix’ make it slower before the real optimisation takes it 14× faster. All numbers measured and ThreadSanitizer-clean.

June 20, 2026 · 9 min · HFT Engineer's Roadmap