AtomicMarkableReference
Learn to use the AtomicMarkableReference class for designing lock-free data structure such as linked-lists.
If you are interviewing, consider buying our number#1 course for Java Multithreading Interviews.
Overview
The AtomicMarkedReference class is similar to the AtomicStampedReference class in that it holds a reference to an object but instead of an integer stamp it takes in a boolean value, called the mark. Both these fields can be updated atomically either together or individually. One could argue that AtomicStampedReference class would behave similarly to AtomicMarkableReference class if it accepted only two possible values for the integer stamp argument.
The code widget below demonstrates some of the basic operations when working with the AtomicMarkableReference class.
Example
AtomicMarkableReference can be put to good use when designing lock-free lists, such as a set representation backed by a ...