An SPSC bounded queue is a fixed-capacity FIFO structure with exactly one producer and one consumer. It tracks monotonically increasing front and back indexes, wraps array access with modulo arithmetic, and reports full or empty states. section 8.6
The concurrent version replaces ordinary indexes with atomic counters. The producer writes an item before releasing back; the consumer reads after acquiring back, then releases front. Relaxed operations serve each thread’s own counter, while acquire and release operations publish data safely without mutual exclusion. section 8.6
Benchmarking the queue
A Rust benchmark runs a producer and consumer against a 128-element queue. The measured pop time is approximately 72.8 ns, compared with approximately 1.11 µs for the non-atomic queue benchmark.
