C-LOOK Disk Scheduling Algorithm
An improved variant of the SCAN and LOOK disk scheduling methods is the C-LOOK disk scheduling algorithm. The search time of this technique is faster than that of the C-SCAN algorithm, but it still uses the same concept of wrapping the tracks into a circular cylinder. As with C-SCAN, which we know is utilised to prevent starvation and provide more uniform service to all requests, C-LOOK does the same. In this algorithm, the head starts from first request in one direction and moves towards the last request at other end, serving all request in between. After reaching last request in one end, the head jumps in other direction and move towards the remaining requests and then satisfies them in same direction as before. Unlike SSTF, it doesn’t serves the task request which is closest to the current position of head or pointer.
Example –
Consider a disk with 200 tracks (0-199) and the disk queue having I/O requests in the following order as follows :
98, 183, 40, 122, 10, 124, 65
The current head position of the Read/Write head is 53 and will move in Right direction . Calculate the total number of track movements of Read/Write head using C-LOOK algorithm.
Total head movements = (65-53)+(98-65)+(122-98)
+(124-122)+(183-124)+(183-10)+(40-10)
= 333
Algorithm of C-LOOK
- Step 1: Assume that the head is the location of the disk head and that the Request array is an array that stores the indexes of the songs that have been requested in ascending order of arrival time.
- Step 2: The head moves in the same way as it did initially, and it continues in that direction.
- Step 3: The head responds to each request individually as it moves in that direction.
- Step 4: Until all requests in this direction have been fulfilled, the head keeps moving in the same direction.
- Step 5: Determine the exact separation between the tracks and the head while proceeding in this manner.
- Step 6: Using this distance, increase the total number of seeks.
- Step 7: The head position is now the currently serviced track position.
- Step 8: Repeat steps 5 through 8 until the final request is made in this manner.
- Step 9: Should we reach the final request in the current direction, we will turn around and move the head in that direction until we reach the final request that must be fulfilled in this direction, skipping the requests that come before it.
- Step 10: Change course and return to step 3 until no inquiries remain unanswered.
Advantages of C-LOOk
- Determine the disk head’s starting location.
- Arrange the disk requests that are still outstanding in the order that they will be addressed.
- As requests come in, handle them by scanning the disk in the selected direction.
- Return to the beginning of the disk and resume the operation as soon as the final request in the current direction has been fulfilled.
Disadvantages of C-LOOK
- When a lot of data needs to be read or written in one route, it might not be the best option because a lot of requests might get queued up in the other direction.
- It does not prioritise requests according to their urgency or relevance, therefore it might not be appropriate for real-time systems where quick response times are essential.
- Requests that are positioned far from the disk head’s current position may become starved as a result.
Difference Between SSTF and C-LOOK Disk Scheduling Algorithm
The secondary storage scheduling algorithm known as SSTF decides how the disk’s head and arm will move in response to read and write requests while in C-SCAN 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. You will discover the distinction between the SSTF and C-LOOK disk scheduling algorithms in this post. However, you must first understand the distinctions between the SSTF and C-LOOK disk scheduling algorithms.