Cognitive Scaffold

Preparing your thinking workspace

arrow_back_ios_new
MENTAL MODEL · M5811

Busy Waiting

Busy Waiting
SystemsHigh supportSystems Theory
Included
account_tree

Updated 2026-07-28

Loading revision record…

Summary

In software engineering, busy waiting (also known as spinning; English: Busy waiting, busy-looping, spinning) is a technique based on a process repeatedly checking whether a condition is true, which may be keyboard input or whether a lock is available. Busy waiting can also be used to generate an arbitrary time delay, if the system does not provide a method to generate a specific length of time, then busy waiting is needed.

Definition

In software engineering, busy waiting (also known as spinning; English: Busy waiting, busy-looping, spinning) is a technique based on a process repeatedly checking whether a condition is true, which may be keyboard input or whether a lock is available. Busy waiting can also be used to generate an arbitrary time delay, if the system does not provide a method to generate a specific length of time, then busy waiting is needed. Different computer processors vary greatly in speed, especially some processors are designed to dynamically adjust their rate based on external factors (such as load on the operating system). Therefore, busy waiting as a time delay technique is prone to unpredictable and even inconsistent results, unless the implementation code determines the speed at which the processor executes the 'do nothing' loop, or the loop code explicitly checks the real-time clock. In some cases, busy waiting is an effective strategy, especially on operating systems that implement spinlock designs for symmetric multiprocessing. However, in general, busy waiting is an anti-pattern that should be avoided; processor time should be used to perform other tasks rather than being wasted on useless activity.

How to use

In software engineering, busy waiting (also known as spinning; English: Busy waiting, busy-looping, spinning) is a technique based on a process repeatedly checking whether a condition is true, which may be keyboard input or whether a lock is available. Busy waiting can also be used to generate an arbitrary time delay, if the system does not provide a method to generate a specific length of time, then busy waiting is needed.

Mechanism

Busy waiting (spinning): a thread repeatedly polls and checks a condition without yielding the CPU, achieving extremely low latency response but wasting computing power; it is a classic trade-off of CPU usage for response speed.

Practice

In progress 0/4

Practice this model in one real situation:

Check to track your progress (stored locally)
Learning progress0%

Cases

  • Spinlocks protecting very short critical sections; retry loops in lock-free data structures; polling status bits of hardware registers.

Common pitfalls

  • Busy waiting during long waits wastes CPU; ignoring memory visibility can lead to infinite loops; forgetting backoff can cause livelock.
Sources

Source support: Explicit

References currently contain only Wikipedia links; primary sources still need review.

  • link
    zh.wikipedia.orghttps://zh.wikipedia.org/wiki/%E5%BF%99%E7%A2%8C%E7%AD%89%E5%BE%85ZH · Explicit
    verified
account_treeGenealogyexpand_more

RELATED MODELS