Elevators Algorithm (SCAN)

Elevators Algorithm

SCAN


Elevators Algorithm is another disk scheduling algorithm, as the name suggest its roots lay on working of an elevator. i.e., Once started then it goes in the same direction, being said that there are various modifications to it and we will look upon two well known methods to implement elevators algorithm.

In this post we will see SCAN algorithm in detail , with a complete cpp code to stimulate it. We will use busy scanning for coding purpose. i.e, The pointing head will keep scanning even if there is nothing to be scheduled, but some disk are yet expected to scheduled.

SCAN


Suppose we have a tape, which is indexed from 0 to Nth location. Assume we start from a location x <= N  and we choose one direction Left or Right, Assuming we take Right we will start processing all the requests coming till we move to the end of the tape without changing direction and after reaching the end of the tape , we will change the direction and continue till another end. This method is known as SCAN and it can be better understood by the theoretical model given above.




CPP Program for SCAN




Written by , Sarvesh Bhatnagar

Popular Posts