Algorithm of C-SCAN
- Step 1: Let the Request array be an array that stores the indexes of the requested tracks in ascending order of arrival time. “head” refers to the disk head’s location.
- Step 2: From 0 to the disk size, the head only provides services in the correct direction.
- Step 3: Do not service any rails when travelling in a leftward direction.
- Step 4: Reverse the direction when we get to the beginning (left end).
- Step 5: It services each track individually while travelling in the correct direction.
- Step 6: Determine the track’s absolute distance from the head while proceeding in the correct direction.
- Step 7: Increase the number of searches made overall at this distance.
- Step 8: The head position is now the currently served track position.
- Step 9: Continue from step 6 until we get to the disk’s right end.
- Step 10: Until all of the songs in the request array have not been served, turn around and go back to step 3 if we reach the right end of the disk.
Difference Between C-SCAN and SSTF Disk Scheduling Algorithm
In C-SCAN Algorithm it is necessary to take into account the direction, i.e., larger or smaller value. This algorithm serves disk requests by moving towards their conclusion while SSTF is a secondary storage scheduling method that decides how the disk’s head and arm will move to fulfil read and write requests. In this article, you will discover the distinction between the SSTF and C-SCAN disk scheduling algorithms in this post. However, you must first understand the distinctions between the SSTF and C-SCAN disk scheduling algorithms.