what is busy waiting in os

1 year ago 63
Nature

Busy waiting is a process synchronization technique used in operating systems where a process/task waits and constantly checks for a condition to be satisfied before proceeding with its execution. In busy waiting, a process executes instructions that test for the entry condition to be true, such as the availability of a lock or resource in the computer system. There are two general approaches to waiting in operating systems: busy waiting and sleeping. In busy waiting, a process continuously checks for the condition to be satisfied while consuming the processor. In contrast, in sleeping, a process waits without consuming the processor and is alerted or awakened when the condition is satisfied.

Busy waiting can be inefficient in some operating systems because the looping procedure is a waste of computer resources, and the system is left idle while waiting. This is particularly wasteful if the task/process at hand is of low priority, as resources that can be diverted to complete high-priority tasks are hogged by a low-priority task in busy waiting. However, busy waiting can be made much less wasteful by using a delay function.

In summary, busy waiting is a process synchronization technique in which a process constantly checks for a condition to be satisfied before proceeding with its execution. It is one of two general approaches to waiting in operating systems, the other being sleeping. Busy waiting can be inefficient in some operating systems, but it can be made less wasteful by using a delay function.