Understanding condition variables in concurrent systems
This foundational operating-systems question tests whether you grasp the core synchronisation primitive that enables threads to wait efficiently for specific conditions to occur. It is the kind of conceptual question that trading and infrastructure teams ask to confirm you understand the building blocks of low-latency concurrent code.
To answer well, you need to distinguish condition variables from other synchronisation mechanisms (like mutexes) and explain the problem they solve: how one thread can block until another thread signals that a shared state has changed, without busy-waiting or polling. The answer hinges on understanding the relationship between locks, predicates, and efficient thread scheduling.
- Mutex vs. condition variable semantics
- Lost wakeup and spurious wakeup scenarios
- The notify-one and notify-all patterns