Skip to main content
QUICK REVIEW

[Paper Review] Single-Producer/Single-Consumer Queues on Shared Cache Multi-Core Systems

Massimo Torquati|arXiv (Cornell University)|Dec 8, 2010
Parallel Computing and Optimization TechniquesComputer Science12 references15 citations
TL;DR

This paper presents a novel, efficient, unbounded wait-free Single-Producer/Single-Consumer (uSPSC) queue for shared-cache multi-core systems, based on a modified Lamport circular buffer that minimizes dynamic memory allocation and maximizes cache locality. The algorithm achieves high performance by using a multi-push optimization and avoids memory barriers, outperforming traditional list-based queues in both synthetic benchmarks and real-world pipeline workloads.

ABSTRACT

Using efficient point-to-point communication channels is critical for implementing fine grained parallel program on modern shared cache multi-core architectures. This report discusses in detail several implementations of wait-free Single-Producer/Single-Consumer queue (SPSC), and presents a novel and efficient algorithm for the implementation of an unbounded wait-free SPSC queue (uSPSC). The correctness proof of the new algorithm, and several performance measurements based on simple synthetic benchmark and microbenchmark, are also discussed.

Motivation & Objective

  • To address the performance bottleneck of traditional list-based SPSC queues due to dynamic memory allocation and poor cache locality.
  • To design a wait-free unbounded SPSC queue that avoids expensive memory barriers and reduces reliance on dynamic allocation.
  • To improve cache performance and throughput in producer-consumer workloads on shared-cache multi-core architectures.
  • To provide a provably correct, high-performance alternative to existing SPSC queue implementations for streaming and pipeline workloads.

Proposed method

  • Extends Lamport’s wait-free circular buffer algorithm to support unbounded size using dynamic memory allocation only when necessary.
  • Introduces a multi-push optimization (mpush) that batches multiple elements into a single atomic operation to reduce cache misses and improve locality.
  • Uses a modified buffer structure where entries are marked as BOTTOM to indicate availability, enabling safe non-blocking operations.
  • Employs a lock-free, wait-free design using only compare-and-swap (CAS) operations, avoiding explicit synchronization and memory barriers.
  • Pins the producer and consumer to the same core when possible to exploit shared L1/L2 cache and reduce false sharing.
  • Applies compiler and memory access optimizations to reduce L1 and L2 cache misses in the critical path of queue operations.

Experimental results

Research questions

  • RQ1Can an unbounded SPSC queue be implemented without dynamic memory allocation overhead while maintaining wait-freedom and correctness?
  • RQ2How does the multi-push optimization affect cache performance and latency in SPSC queue operations?
  • RQ3What is the performance impact of core affinity (pinning producer and consumer to the same core) on queue throughput and latency?
  • RQ4How does the proposed uSPSC queue compare to bounded SPSC and dynamic list-based SPSC queues in real-world pipeline workloads?
  • RQ5Can the algorithm be made correct and efficient under weak memory models like PowerPC or Itanium without relying on memory barriers?

Key findings

  • The multi-push (mpush) optimization reduces L1 cache misses by approximately 50% and L2 misses by over 50% compared to standard push operations in SPSC queues.
  • Average latency per push/pop operation drops from 10–11ns in the standard SPSC to 6–9ns in the multi-push version, improving performance by up to 30%.
  • The unbounded multi-push SPSC (muSPSC) queue achieves a maximum speedup of 1.4 in a real pipeline benchmark, outperforming the bounded mSPSC (1.28) and dynamic list-based dSPSC (0.98).
  • The muSPSC queue is less sensitive to cache optimization than the uSPSC queue, indicating that the multi-push optimization provides greater benefit in bounded scenarios.
  • When producer and consumer are pinned to the same core, performance improves significantly due to better cache locality and reduced false sharing.
  • The proposed uSPSC queue avoids expensive memory barriers and dynamic allocation overhead, achieving better performance than list-based alternatives despite using dynamic memory only when necessary.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.