ABA and Versioned Atomic State

Explain why observing the same representation twice can be insufficient and use an explicit version or lifetime guarantee where history matters.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. A comparison tests a representation at the present instant
  2. Couple identity to the invariant that needs protection

A comparison tests a representation at the present instant

In a conditional update, a thread remembers value \(A\), and while it waits the location can change to \(B\) and back to \(A\). A successful compare-and-swap tells it that the representation equals \(A\) at comparison time. It does not tell whether the location changed in between. This matters if the update relies on associated data remaining unchanged.

Couple identity to the invariant that needs protection

A version field updated in the same atomic state can distinguish repetitions within its nonwrapping range. Preventing recycling of an object during use can instead preserve a lifetime identity. Some algorithms remain correct when the state returns to an equivalent representation and need neither distinction. Hazard pointers protect selected object lifetimes. Linearization arguments explain why a successful atomic change is meaningful for the abstract operation.[1][2]

References

  1. Maurice Herlihy and Nir Shavit, The Art of Multiprocessor Programming ↩
  2. Maged M. Michael, Hazard Pointers: Safe Memory Reclamation for Lock-Free Objects ↩