Java Reference
In-Depth Information
Listing 15.6. Nonblocking Stack Using Treiber's Algorithm (
Treiber, 1986
).
We need several tricks to develop this plan. The first is to ensure that the data structure is
always in a consistent state, even in the middle of an multi-step update. That way, if thread
A
is in the middle of a update when thread
B
arrives on the scene,
B
can tell that an operation