In computer science a process(or) is said to be "busy waiting" if it continually checks if some condition is true until it becomes true. The processor spends all its time, is busy, waiting for some condition to become true. It may also be said to be "polling".

Busy waiting is a term used in operating system development and here especially process synchronization. When two or more processes want to enter the same critical section, something has to be done to prevent more than one process from entering it. An example would be the famous printing problem (two processes want to print at the same time) or two processes have shared memory. This memory has a well-defined structure, which process 2 needs to read data. Process 1 is the producing process, which ,when interrupted during writing, may leave a corrupt structure behind (think about a linked list: Process 1 wants to at an element at the front, and is interrupted before setting the next pointer. For process 2 the structure now only consists of one element.)

To prevent such situations some way to achieve mutual exclusion has to be found. Most of the early algorithms were busy waiting. This means, that when they were not able to enter the critical section the waited actively, till they were allowed. This was often a while loop checking variables (or making a system call).

Although algorithms using busy waiting are mostly easy to understand and implement, they are a do not in OS development. Because in a time-sharing system a process would still get processor time just for running this useless loop. Modern methods like monitors or semaphores work differently. When the process was not able to enter its critical section, it is put to sleep. When the resource is available again, it is woken up and may now get processor time from the scheduler.

Log in or register to write something here or to contact authors.