S.C.A.N
Theory :
  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.

Advantages:

  • 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 in static mode.

Disadvantages:

  • SCAN disk scheduling algorithm takes long waiting time for the cylinders, just visited by the head.
  • In 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.
  • More complex algorithm to implement.
  • Starvation may happen in dynaic mode.

Example:

Consider a disk queue with requests for I/O to blocks on cylinders (98, 183, 41, 122, 14, 124, 65, 67) The SCAN scheduling algorithm is used.
The head is initially at cylinder number 53 moving towards larger cylinder numbers on its servicing pass.The cylinders are numbered from 0 to 199. The total head movement (in number of cylinders) incurred while servicing these requests is ___.
>
Total head movements incurred while servicing these requests = (65 – 53) + (67 – 65) + (98 – 67) + (122 – 98) + (124 – 122) + (183 – 124) + (199 – 183) + (199 – 41) + (41 – 14) = 12 + 2 + 31 + 24 + 2 + 59 + 16 + 158 + 27 = 331

Steps to excute:

  • Input the queue you want to be scheduled using SCAN.
  • Input the current position of the head.
  • After execution of the queue you will get the required seek count and the seek sequence (The direction is by default set to left).
Output of the algorithm