The SCAN disk scheduling algorithm is another type of disk scheduling algorithm. In this algorithm, we move the disk arm into a specific direction (direction can be moved towards large value or the smallest value). Each request is addressed that comes in its path, and when it comes into the end of the disk, then the disk arm will move reverse, and all the requests are addressed that are arriving in its path. Scan disk scheduling algorithm is also called an elevator algorithm because its working is like an elevator.
Algorithm:
Let Request array represents an array storing indexes of tracks that have been requested in ascending order of their time of arrival. ‘head’ is the position of disk head.
Let direction represents whether the head is moving towards left or right.
In the direction in which head is moving service all tracks one by one.
Calculate the absolute distance of the track from the head.
Currently serviced track position now becomes the new head position.
Go to step 3 until we reach at one of the ends of the disk.
If we reach at the end of the disk reverse the direction and go to step 2 until all tracks in request array have not been serviced.
Video:
Advantages of SCAN Disk scheduling Algorithm:
The advantages of SCAN disk scheduling algorithm are:
In SCAN disk scheduling, there is a low variance of response time.
In this algorithm, throughput is high.
Response time is average.
In SCAN disk scheduling, there is no starvation.
Disadvantages of SCAN Disk Scheduling Algorithm:
The disadvantages of SCAN disk scheduling algorithm are:
SCAN disk scheduling algorithm takes long waiting time for the cylinders, just visited by the head.
In C-SCAN disk scheduling, we have to move the disk head to the end of the disk even when we don’t have any request to service.