operating-system-active-waiting.html


* created: 2025-05-18T21:58
* modified: 2025-06-30T21:36

title

Active waiting

description

Active waiting or busy waiting describes the process of polling a lock until it's unlocked.

related notes

Doing nothing really hard

Active waiting or busy waiting is the process of polling a lock, which can be a simple variable for example, until it is unlocked. Keep in mind that this behavior could result in a deadlock.

while lock == 1 { /* do nothing */ };

This is a straightforward method to ensure that a resource can't be accessed by more than one process at a time. The resource just locks and all other process have to wait until it unlocks.

Keep in mind that this, while being a quite simple approach, also comes with a performance overhead. Each process must repeatedly check whether the resource is available, rather than being placed in a queue and notified when it's their turn.