ABA Prevention Using Single-Word Instructions

The ABA problem is a fundamental problem that affects almost all lock-free algorithms. The atomic primitives LL/SC/VL (Load-Linked, Store-Conditional, Validate) offer a convenient way for algorithm designers to reason about lock-free algorithms, without concern for the ABA problem. However, for practical architectural reasons, no processor architecture supports the ideal semantics of LL/VL/SC. It is relatively easy to implement LL/SC/VL—and prevent the ABA problem—using double-word atomic instructions. However, most current mainstream 64-bit architectures support only single-word atomic instructions. The best known constructions of LL/SC/VL using singleword instructions entail substantial space overhead when applied to a large number of memory locations, and require knowing the maximum number of threads in advance. This report presents simple lock-free constructions using only practical single-word instructions for implementing ideal LL/SC/VL, and hence preventing the ABA problem, with reasonable space overhead. These constructions can also be used to implement arbitrary width atomic operations.