Basic Steps Involved in the C-LOOK Algorithm
- Determine the initial position of the disk head.
- Sort the pending disk requests in the order in which they will be serviced.
- Scan the disk in the chosen direction, servicing requests as they are encountered.
- When the last request in the current direction has been serviced, immediately return to the beginning of the disk and repeat the process.
C-LOOK Disk Scheduling Algorithm
C-LOOK Disk Scheduling Algorithm is an enhanced version of both SCAN as well as LOOK disk scheduling algorithms. This algorithm also uses the idea of wrapping the tracks as a circular cylinder as the C-SCAN Algorithm but the seek time is better than the C-SCAN algorithm. We know that C-SCAN is used to avoid starvation and services all the requests more uniformly, the same goes for C-LOOK.
In this algorithm, the head services request only in one direction(either left or right) until all the requests in this direction are not serviced and then jumps back to the farthest request in the other direction and services the remaining requests which gives a better uniform servicing as well as avoids wasting seek time for going till the end of the disk.
In this article, we will see given an array of disk track numbers and initial head position, our task is to find the total number of seek operations to access all the requested tracks if the C-LOOK disk scheduling algorithm is used. Also, write a program to find the seek sequence using the C-LOOK disk scheduling algorithm.