A general lock-free algorithm using compare-and-swap

Research output: Contribution to journalArticleAcademicpeer-review

17 Citations (Scopus)
411 Downloads (Pure)

Abstract

The compare-and-swap register (CAS) is a synchronization primitive for lock-free algorithms. Most uses of it, however, Stiffer from the so-called ABA problem. The simplest and most efficient solution to the ABA problem is to include a tag with the memory location Such that the tag is incremented with each update of the target location. This Solution, however, is theoretically unsound and has limited applicability. This paper presents a general lock-free pattern that is based on the synchronization primitive CAS Without causing ABA problem or problems with wrap around. It can be used to provide lock-free functionality for any data type. Our algorithm is a CAS variation of Herlihy's LL/SC methodology for lock-free transformation. The basis of Our techniques is to poll different locations on reading and writing objects in such a way that the consistency of an object can be checked by its location instead of its tag. It consists of simple code that can be easily implemented using C-like languages. A true problem of lock-free algorithms is that they are hard to design correctly, which even holds for apparently straightforward algorithms. We therefore develop a reduction theorem that enables Lis to reason about the general lock-free algorithm to be designed on a higher level than the synchronization primitives. The reduction theorem is based on Lamport's refinement mappings, and has been verified with the higher-order interactive theorem prover PVS. Using the reduction theorem, fewer invariants are required and some invariants are easier to discover and formulate without considering the internal structure of the final implementation, (C) 2006 Elsevier Inc. All rights reserved.

Original languageEnglish
Pages (from-to)225-241
Number of pages17
JournalInformation and Computation
Volume205
Issue number2
DOIs
Publication statusPublished - Feb-2007

Keywords

  • lock-free
  • refinement mapping
  • atomicity
  • compare-and-swap
  • correctness

Fingerprint

Dive into the research topics of 'A general lock-free algorithm using compare-and-swap'. Together they form a unique fingerprint.

Cite this