Questions
Read the code, predict what happens, then see why. Hand-written questions on C++, Rust, and the systems underneath them.
- A volatile flag used for a producer/consumer handoffMedium
- A hand-rolled spinlock built on std::atomic_flagMedium
- Two atomic counters on the same cache lineMedium
- Relaxed fetch_add operations between a release store and an acquire loadHard
- std::call_once with a std::once_flag for lazy initializationMedium
- Classifying a CAS retry loopMedium
- Guarding condition_variable::wait with if instead of whileMedium
- Checking a condition variable's predicate outside the mutexHard
- Treiber stack pop with a reused node addressHard
- Treiber stack pop with a tagged pointer and double-width CASHard
- A locked method calling a helper that locks the same mutexMedium
- SPSC ring buffer with free-running head and tail indicesHard
- A std::thread destroyed without join or detachEasy
- Two threads locking two mutexes in opposite orderMedium
- memory_order_consume on a released pointerHard
- atomic_thread_fence paired with relaxed atomic flagsHard
- std::jthread destruction when the worker never checks a stop tokenMedium
- Work-stealing deque with owner and thieves on opposite endsMedium
- std::counting_semaphore limiting concurrent connectionsEasy
- Stackless coroutines vs one OS thread per connectionMedium
1–20 of 51
Page 1 of 3