A process stuck in busy waiting during synchronization waste
A process stuck in busy waiting during synchronization wastes CPU time. Is there any advantages under certain scenarios, to tolerate such busy waiting in a multiprocessor enviornment? Explain.
Solution
Explanation:
Busy waiting means that a process is waiting for a condition to be satisfied in a tight loop without relinquishing the processor. Alternatively, a process could wait by relinquishing the processor, and block on a condition and wait to be awakened at some appropriate time in the future. Busy waiting can be avoided but incurs the overhead associated with putting a process to sleep and having to wake it up when the appropriate program state is reached.
Advantages:
Busy waiting means a process simply spins while it is waiting to enter its critical section. This continues to use (waste) CPU cycles, which is inefficient. Additionally, if a low priority process is in its critical section, and a high priority process goes into busy waiting, it may never get to its critical section., On a single CPU, busy waiting becomes a circular issue, so blocking would make more sense, as it only requires a single call to the OS to change state to Ready/Run,once it is notified that blocking process is complete. For blocking solutions, we would
need to be careful because there is a chance that an incremental counter might be corrupted; processes can go into a sleep state and never awake. Additionally, while busy waiting may waste cycles on a single processor, blocking may waste cycles on a multiprocessor.
