Lock-Free Dynamically Resizable Arrays

  • Damian Dechev
  • Peter Pirkelbauer
  • Bjarne Stroustrup
Conference paper

DOI: 10.1007/11945529_11

Part of the Lecture Notes in Computer Science book series (LNCS, volume 4305)
Cite this paper as:
Dechev D., Pirkelbauer P., Stroustrup B. (2006) Lock-Free Dynamically Resizable Arrays. In: Shvartsman M.M.A.A. (eds) Principles of Distributed Systems. OPODIS 2006. Lecture Notes in Computer Science, vol 4305. Springer, Berlin, Heidelberg

Abstract

We present a first lock-free design and implementation of a dynamically resizable array (vector). The most extensively used container in the C++ Standard Template Library (STL) is vector, offering a combination of dynamic memory management and constant-time random access. Our approach is based on a single 32-bit word atomic compare-and-swap (CAS) instruction. It provides a linearizable and highly parallelizable STL-like interface, lock-free memory allocation and management, and fast execution. Our current implementation is designed to be most efficient on multi-core architectures. Experiments on a dual-core Intel processor with shared L2 cache indicate that our lock-free vector outperforms its lock-based STL counterpart and the latest concurrent vector implementation provided by Intel by a large factor. The performance evaluation on a quad dual-core AMD system with non-shared L2 cache demonstrated timing results comparable to the best available lock-based techniques. The presented design implements the most common STL vector’s interfaces, namely random access read and write, tail insertion and deletion, pre-allocation of memory, and query of the container’s size. Using the current implementation, a user has to avoid one particular ABA problem.

Keywords

lock-free STL C++ vector concurrency real-time systems 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Damian Dechev
    • 1
  • Peter Pirkelbauer
    • 1
  • Bjarne Stroustrup
    • 1
  1. 1.Texas A&M UniversityUSA

Personalised recommendations