← 🔗 Algorithms

🔗 The Michael-Scott Lock-Free Queue

CAS retries:
Queue length:
Drag — rotate · Scroll — zoom

🔗 The Michael-Scott Lock-Free Queue

The simulator visualizes multiple threads racing to enqueue and dequeue nodes on a shared linked list, showing each compare-and-swap attempt, its success or failure, and the moment the tail pointer lags one node behind reality until another thread helps advance it.

🔬 What It Demonstrates

The simulator visualizes multiple threads racing to enqueue and dequeue nodes on a shared linked list, showing each compare-and-swap attempt, its success or failure, and the moment the tail pointer lags one node behind reality until another thread helps advance it.

🎮 How to Use

Add threads and trigger enqueue or dequeue operations, then step through execution one atomic instruction at a time to watch the head and tail pointers, the linked list structure, and each compare-and-swap outcome update in real time.

💡 Did You Know?

The tail pointer in a Michael-Scott queue is allowed to be stale by exactly one node at any moment, and every operation is written to detect and repair that staleness opportunistically, which is precisely what lets the algorithm avoid ever needing a lock.