The ABA problem occurs when multiple threads (or processes) accessing shared data interleave.
can continue executing, it is possible that the behavior will not be correct due to the "hidden" modification in shared memory.
A common case of the ABA problem is encountered when implementing a lock-free data structure.
In C++, as shown here, accessing freed memory is undefined behavior: this may result in crashes, data corruption or even just silently appear to work correctly.
A common workaround is to add extra "tag" or "stamp" bits to the quantity being considered.
Hazard pointers are lock-free, but can only track at most a fixed number of elements per thread as being in-use.
Using RCU in this way guarantees that any data element removed cannot reappear until all currently executing operations have completed.