Master the fundamental concepts of lock-free & wait-free programming through this focused micro-challenge.
Lock-free structures shine under moderate contention and small critical sections. Mutexes plus a simple queue often win when critical sections are large, when you need condition variables, or when every core hammers the same CAS cache line.
Measure throughput and tail latency, not ideology. Consider memory reclamation cost, programmer complexity, and priority inversion requirements.
cLoading…
perf stat -e cache-misses on CAS loops shows line bouncingKeep 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 benchmark lock-free queue vs mutex-backed queue under increasing thread counts. This exercise requires plotting where each approach wins and explaining the crossover.
Benchmark lock-free queue against mutex-based queue.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github