An invariant is a condition that remains true about a data structure in a valid state. Updates may temporarily break it; shared access becomes risky if another thread can observe that intermediate state. section 3.1
Removing a node from a doubly linked list
If node A points next to B, B should point back to A. Removing a node requires changing both neighboring links. Between those updates, the forward and backward links disagree, so a concurrent reader may observe a broken invariant. section 3.1
The diagram shows how deleting a node temporarily leaves the links inconsistent. section 3.1
Ways to prevent other threads from observing broken invariants include:
- Protect the data structure so other threads cannot see intermediate updates. section 3.1.2
- Redesign updates as indivisible changes that each preserve the invariants; this is difficult and involves memory-model nuances. section 3.1.2
- Use transactional updates that commit together and restart if another thread has changed the data. section 3.1.2











