DISK SCHEDULING

Experiment Number 5 : C-SCAN



Algorithm

• Step 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.

• Step 2: The head services only in the right direction from 0 to the size of the disk.

• Step 3: While moving in the left direction do not service any of the tracks.

• Step 4: When we reach the beginning(left end) reverse the direction.

• Step 5: While moving in the right direction it services all tracks one by one.

• Step 6: While moving in the right direction calculate the absolute distance of the track from the head.

• Step 7: Increment the total seek count with this distance.

• Step 8: Currently serviced track position now becomes the new head position.

• Step 9: Go to step 6 until we reach the right end of the disk.

• Step 10: If we reach the right end of the disk reverse the direction and go to step 3 until all tracks in the request array have not been serviced.