Jump to content

ABA problem

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Sutekh.destroyer (talk | contribs) at 23:56, 18 February 2008 (Made reference into ordered list). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The ABA problem occurs when multiple threads (or processes) accessing shared memory interleave. Below is the sequence of events that will result in the ABA problem:

  • Process reads value A from shared memory,
  • is preempted, allowing process ,
  • modifies the shared memory value A to value B and back to A before preemption,
  • begins execution again, sees that the shared memory value has not changed and continues.

Although can continue executing, it is possible that the behavior will not be correct due to the "hidden" modification in shared memory.

References

  1. Damian Dechev, Peter Pirkelbauer, and Bjarne Stroustrup. Lock-free Dynamically Resizable Arrays