# A Scalable, Portable, and Memory-Efficient Lock-Free FIFO Queue

**Authors:** Ruslan Nikolaev

arXiv: 1908.04511 · 2019-08-14

## TL;DR

This paper introduces a scalable, memory-efficient lock-free FIFO queue supporting multiple producers and consumers, which is ABA-safe, does not need external memory management, and performs well across architectures.

## Contribution

The paper presents a novel lock-free MPMC FIFO queue design that is both memory-efficient and ABA-safe, using FAA instructions and a general approach adaptable to bounded and unbounded queues.

## Key findings

- Outperforms existing scalable queues in memory efficiency
- Achieves comparable or better performance than state-of-the-art algorithms
- Supports both bounded and unbounded FIFO queue implementations

## Abstract

We present a new lock-free multiple-producer and multiple-consumer (MPMC) FIFO queue design which is scalable and, unlike existing high-performant queues, very memory efficient. Moreover, the design is ABA safe and does not require any external memory allocators or safe memory reclamation techniques, typically needed by other scalable designs. In fact, this queue itself can be leveraged for object allocation and reclamation, as in data pools. We use FAA (fetch-and-add), a specialized and more scalable than CAS (compare-and-set) instruction, on the most contended hot spots of the algorithm. However, unlike prior attempts with FAA, our queue is both lock-free and linearizable.   We propose a general approach, SCQ, for bounded queues. This approach can easily be extended to support unbounded FIFO queues which can store an arbitrary number of elements. SCQ is portable across virtually all existing architectures and flexible enough for a wide variety of uses. We measure the performance of our algorithm on the x86-64 and PowerPC architectures. Our evaluation validates that our queue has exceptional memory efficiency compared to other algorithms and its performance is often comparable to, or exceeding that of state-of-the-art scalable algorithms.

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/1908.04511/full.md

## Figures

30 figures with captions in the complete paper: https://tomesphere.com/paper/1908.04511/full.md

## References

24 references — full list in the complete paper: https://tomesphere.com/paper/1908.04511/full.md

---
Source: https://tomesphere.com/paper/1908.04511