Demonstration of Busy Waiting
This process of busy waiting concerning the scenario is demonstrated below:
Step 1: Process 1 makes use of a shared resource
As shown in the above diagram, process 1 makes use of a shared resource. It releases the resource only once it has completed its task or any other high-priority process arises.
Step 2: Process 2 needs the shared resource that is already being used by process 1
As shown in above diagram the process 2 needs the shared resource, but the resource is already in used by the process 1. Therefore it needs to wait until the resource is free.
Step 3: Process 2 enters into busy waiting state until its get access to the shared resource
As shown in above diagram, the process 2 goes in busy waiting state that makes use of the processor and continuously checks for the shared resource to get allocated.
Busy Waiting in OS
Waiting in the operating system consists of two approaches namely Busy Waiting and Sleep Waiting. Busy waiting is defined as the process where the process or task continuously the processor and waits for the condition to be satisfied. Whereas Sleep waiting is defined as a process where the task or process does not consume the processor when it is waiting for its condition to be satisfied. The below article covers in detail busy waiting.