.. /index

atomic_queue

atomic_queue

atomic_queue is a header-only C++ library by Maxim Egorshin providing several lock-free MPMC queue implementations. Its OptimistAtomicQueue consistently wins C++ benchmarks for highest throughput and lowest latency: sub-100 ns round-trip push-to-pop in MPMC mode, SPSC throughput exceeding 200M ops/s, and 200–500M+ ops/s in 1P/1C configuration.

What's inside

The library provides a family of fixed-capacity, ring-buffer-backed queues:

All use power-of-two capacity for cheap modular arithmetic and apply cache-line padding aggressively.

Why it wins on latency

OptimistAtomicQueue is engineered for the uncontended case: when the next slot is in the expected state, the operation completes in two atomic loads plus a release store, no RMW. Under contention it falls back to a brief busy-wait. This makes it ideal for low-latency systems where the queue is rarely actually contended (HFT, real-time DSP, telemetry pipelines) but absolutely needs sub-100 ns latency on the common path.

When to use it vs alternatives

See also

Linked from

Sources