CSCAN Algorithm
CSCAN
The circular SCAN (C-SCAN) scheduling algorithm is a modified version of the SCAN disk scheduling algorithm that deals with the inefficiency of the SCAN algorithm by servicing the requests more uniformly. Like SCAN (Elevator Algorithm) C-SCAN moves the head from one end servicing all the requests to the other end. However, as soon as the head reaches the other end, it immediately returns to the beginning of the disk without servicing any requests on the return trip (see chart below) and starts servicing again once reaches the beginning. This is also known as the “Circular Elevator Algorithm” as it essentially treats the cylinders as a circular list that wraps around from the final cylinder to the first one.
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.The head services only in the right direction from 0 to size of the disk.
3.While moving in the left direction do not service any of the tracks.
4.When we reach at the beginning(left end) reverse the direction.
5.While moving in right direction it services all tracks one by one.
6.While moving in right direction calculate the absolute distance of the track from the head.
7.Increment the total seek count with this distance.
8.Currently serviced track position now becomes the new head position.
9.Go to step 6 until we reach at right end of the disk.
10.If we reach at the right end of the disk reverse the direction and go to step 3 until all tracks
in request array have not been serviced.