Lock-free dynamically resizable arrays

  • Authors:
  • Damian Dechev;Peter Pirkelbauer;Bjarne Stroustrup

  • Affiliations:
  • Texas A&M University, TX;Texas A&M University, TX;Texas A&M University, TX

  • Venue:
  • OPODIS'06 Proceedings of the 10th international conference on Principles of Distributed Systems
  • Year:
  • 2006

Quantified Score

Hi-index 0.00

Visualization

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.