Busy waiting, busy looping or spinning is a technique in which a process continuously and repeatedly checks if a condition is true. It can be used on checking if a lock is available for example.

In most cases, busy waiting is considered wasteful, and the problems it attempts to solve are generally solvable through other better means like mutexes or interrupts. This is also sometimes referred to as an anti-pattern.

As an example to this wastefulness, we can imagine the following code:

while(!condition){
//do nothing and wait...
}

This simple example illustrates the idea behind busy waiting. If we only have one CPU/core, then our whole machine has to wait, repeatedly for this condition to be true to do anything else.

Busy waiting is however (rightfully) used in the implementations of spinlocks.