Skip to main content
QUICK REVIEW

[Paper Review] Lock-Free and Practical Deques using Single-Word Compare-And-Swap

Håkan Sundell, Philippas Tsigas|ArXiv.org|Aug 5, 2004
Distributed systems and fault toleranceComputer Science19 references11 citations
TL;DR

This paper presents a lock-free, disjoint-parallel-accessible deque implementation using only single-word compare-and-swap (CAS) operations—widely available in modern systems—enabling high performance under high concurrency and non-uniform memory access (NUMA). Unlike prior lock-free deques that rely on non-portable double-word CAS (CAS2) or suffer from contention, this algorithm maintains linearizability and memory safety while outperforming CAS2-based alternatives on highly concurrent NUMA systems.

ABSTRACT

We present an efficient and practical lock-free implementation of a concurrent deque that is disjoint-parallel accessible and uses atomic primitives which are available in modern computer systems. Previously known lock-free algorithms of deques are either based on non-available atomic synchronization primitives, only implement a subset of the functionality, or are not designed for disjoint accesses. Our algorithm is based on a doubly linked list, and only requires single-word compare-and-swap atomic primitives, even for dynamic memory sizes. We have performed an empirical study using full implementations of the most efficient algorithms of lock-free deques known. For systems with low concurrency, the algorithm by Michael shows the best performance. However, as our algorithm is designed for disjoint accesses, it performs significantly better on systems with high concurrency and non-uniform memory architecture.

Motivation & Objective

  • Address the lack of practical, lock-free deques that are disjoint-parallel accessible and use only standard atomic primitives available in modern hardware.
  • Overcome limitations of prior lock-free deques that either restrict functionality (e.g., no concurrent push/pop on opposite ends) or depend on non-portable CAS2 operations.
  • Design a deque that supports dynamic maximum sizes using standard CAS operations and a lock-free memory management scheme.
  • Ensure correctness through linearizability and memory safety, even under high contention and concurrent access.
  • Demonstrate superior performance on high-concurrency, NUMA-architected systems compared to existing lock-free implementations.

Proposed method

  • Implement the deque using a doubly linked list structure with node-level atomic operations.
  • Use single-word compare-and-swap (CAS) for all synchronization, avoiding non-portable CAS2 operations.
  • Design operations (PushLeft, PushRight, PopLeft, PopRight) to be disjoint-parallel accessible, minimizing interference between operations on opposite ends.
  • Integrate a lock-free memory management scheme to support dynamic memory allocation and deallocation without blocking.
  • Apply linearizability proofs using defined linearization points and invariants to ensure correctness under concurrent execution.
  • Implement all atomic primitives in assembly language and use high-optimization C compilation for performance evaluation.

Experimental results

Research questions

  • RQ1Can a lock-free deque be implemented using only standard single-word CAS operations while supporting full functionality and dynamic memory sizing?
  • RQ2Does a disjoint-parallel-accessible design improve performance on high-concurrency, non-uniform memory architecture (NUMA) systems compared to contention-prone lock-free algorithms?
  • RQ3How does a CAS-based deque implementation compare in performance to CAS2-based implementations when CAS2 is emulated in software?
  • RQ4Can a lock-free deque maintain linearizability and memory safety while supporting concurrent operations on both ends without blocking?
  • RQ5Is the proposed algorithm practical and scalable across diverse multiprocessor platforms with varying memory hierarchies?

Key findings

  • The proposed CAS-based deque outperforms CAS2-based implementations on all tested platforms, especially under high concurrency and NUMA conditions.
  • On a 29-processor SGI Origin 2000 system with non-uniform memory access, the algorithm significantly outperforms Michael’s CAS-based implementation from 2 threads onward due to its disjoint-parallel access design.
  • For low to medium concurrency and uniform memory architecture, Michael’s algorithm performs best, but the proposed algorithm surpasses it under high contention and NUMA workloads.
  • The use of software-emulated CAS2 operations (via mutual exclusion or Harris et al.’s CASN) degrades performance compared to native CAS, confirming the advantage of using only single-word CAS.
  • The algorithm maintains linearizability and memory safety, as proven through formal lemmas and invariants, ensuring correctness under all concurrent access patterns.
  • The implementation is practical and has been integrated into the NOBLE library, indicating real-world applicability in concurrent systems.

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.