Busy Waiting
In software engineering, busy-waiting or spinning is a technique in which a process repeatedly checks to see if a condition is true, such as whether keyboard input is available, or if a lock is available. Spinning can also be used to generate an arbitrary time delay, a technique that was necessary on systems that lacked a method of waiting a specific length of time. On modern computers with widely differing processor speeds, spinning as a time delay technique often produces unpredictable results unless code is implemented to determine how quickly the processor can execute a "do nothing" loop.
Spinning can be a valid strategy in certain circumstances, most notably in the implementation of spinlocks within operating systems designed to run on SMP systems. In general, however, spinning is considered an anti-pattern and should be avoided, as processor time that could be used to execute a different task is instead wasted on useless activity.
Read more about Busy Waiting: Example C Code, Busy-waiting Alternatives, Appropriate Busy-wait Usage
Famous quotes containing the words busy and/or waiting:
“Instead of giving in to the greatest misfortune that can happen at my age, deafness, I busy myself in searching out all possible compensations, and I apply myself much more to all the amusements that are here within my grasp.”
—Philip Dormer Stanhope, 4th Earl Chesterfield (16941773)
“Estragon: Charming spot. Inspiring prospects. Lets go.
Vladimir: We cant.
Estragon: Why not?
Vladimir: Were waiting for Godot.”
—Samuel Beckett (19061989)