SCAN Algorithm

SCAN

In SCAN disk scheduling algorithm, head starts from one end of the disk and moves towards the other end, servicing requests in between one by one and reach the other end. Then the direction of the head is reversed and the process continues as head continuously scan back and forth to access the disk. So, this algorithm works as an elevator and hence also known as the elevator algorithm. As a result, the requests at the midrange are serviced more and those arriving behind the disk arm will have to wait.

Algorithm

1. 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.
2.Let direction represents whether the head is moving towards left or right.
3.In the direction in which head is moving service all tracks one by one.
4.Calculate the absolute distance of the track from the head.
5.Increment the total seek count with this distance.
6.Currently serviced track position now becomes the new head position.
7.Go to step 3 until we reach at one of the ends of the disk.
8.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.

Simulator

Request Queue: [ ]

Please enter queries ranging from 0 to 199

Queries:

Add head:

Direction: Right:      Left:  

The Total seek time is: