Definition
Busy Waiting
Busy waiting (or spinning) is a synchronisation technique where a process repeatedly checks a condition in a tight loop until it becomes true. The process remains in the Running state, consuming CPU cycles without performing productive work.
Implementation
Busy waiting appears in low-level synchronisation where expected wait times are short:
while (!condition) {
// spin — no work performed
}
Properties
Low Latency
No context switch or kernel intervention overhead. Suitable for extremely short waits (e.g., multi-processor cache-coherent systems).
CPU Inefficiency
The processor wastes cycles that could execute other processes. No useful work occurs during the spin.
Priority Inversion Risk
A high-priority process spinning on a resource held by a low-priority process may prevent that low-priority process from running to release the resource.
Alternative
Blocking Synchronisation
Modern operating systems prefer blocking: a waiting process enters the Blocked state, and the dispatcher schedules another process. This eliminates wasted CPU cycles but incurs context switch overhead.