Rust developer nahla-nee published a bounded, lock‑free queue implementation in a blog post on March 12, 2026.
Rust developer nahla-nee published a bounded, lock‑free queue implementation in a blog post on March 12, 2026. The design uses two atomic counters to generate reservation numbers and a pair of ring buffers to store items and ownership flags. Each operation waits for a matching reservation number in a state buffer before performing the enqueue or dequeue action, then toggles the ownership flag to hand control to the opposite thread.
The approach avoids repeated compare‑and‑swap loops, which the author says reduces cache contention and provides bounded waiting as long as producers and consumers are both active. Because each thread operates only on its assigned buffer slot, the implementation limits head‑of‑line blocking; a slow producer or consumer does not stall other threads beyond the capacity of the queue.
Technical limitations include a risk of undefined behavior when reservation numbers exceed the range that distinguishes producer from consumer tickets, and potential race conditions when dequeuing types that cannot be copied. The drop operation for a drivable enqueue or dequeue struct performs a full operation before deallocation, which can be costly.
Benchmark results measured on a Ryzen 7 7800x3D system with 32 GiB DDR5 memory and Fedora Linux 44 show throughput ranging from approximately 245 million to 73 million elements per second across different producer‑consumer configurations. Performance peaked when the number of active threads matched the processor’s logical core count, and the one‑producer, multiple‑consumer scenario achieved the highest throughput.
The author states the implementation is not claimed to be groundbreaking and invites further feedback from experts.
- Publisher
- Hacker News
- Reliability
- high
- Published
- 7/10/2026, 10:00:21 AM
- Retrieved
- 7/10/2026, 10:00:21 AM
- Relevance
- 80%
- Confidence
- 85%

