Understanding spurious wakes in concurrent programming
This is a medium-difficulty conceptual question on concurrency that tests whether a candidate understands the guarantees—and limits—of thread synchronization primitives. It appears frequently in interviews at firms building low-latency systems or high-concurrency infrastructure, where incorrect assumptions about condition variables and locks can introduce hard-to-debug race conditions.
The question probes whether you know how operating systems implement thread notification, what guarantees condition variables do and do not provide, and how to write defensive code that doesn't assume a single cause for every thread awakening. A strong answer demonstrates both the mechanism and the practical defensive coding pattern that follows from it.
- Condition variables and their semantics
- Notification vs. predicate satisfaction
- Loop patterns in concurrent code
- The difference between logical and OS-level synchronization