Master the fundamental concepts of lock-free & wait-free programming through this focused micro-challenge.
Wait-free guarantees every thread completes its operation in a bounded number of steps regardless of others. Lock-free only promises system-wide progress. Wait-free stacks and counters exist but often cost more atomic operations or memory than practical lock-free versions.
Wait-free snapshot and some counter implementations use helping: slow threads assist others to finish partial operations. Most production queues stop at lock-free.
cLoading…
Keep the relevant documentation open while you implement. When your output disagrees with the reference, trace one failing case by hand before changing random lines.
You will study a wait-free counter or stack algorithm and implement a simplified version. This exercise requires explaining the progress guarantee difference with a concurrent test.
Implement a wait-free counter and compare it to lock-free and mutex-based approaches.
Requirements:
Test:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
Every task includes starter code, theory, and hidden tests so you can implement and verify locally in the browser.
How it works