Introduction
Today we will be learning about the LOOK disc scheduling algorithm and the CLOOK disc scheduling algorithm. Operating systems do disk scheduling to schedule Input/Output requests arriving for the disk. Disk scheduling is also known as Input/Output scheduling.
To perform Disc Scheduling, we have 6 Disc Scheduling Algorithms as follows:
In this article, we will also solve some examples of scheduling based on LOOK and CLOOK algorithms.
LOOK Algorithm
It is identical to the SCAN disc scheduling algorithm, except that instead of traveling to the end of the track, the disc arm only goes to the last request to be handled in front of the head and then reverses course from there. As a result, the extra time caused by unneeded overhead to the disk end is avoided.
Algorithm
- Arrange all the I/O requests in ascending order.
- It is provided the initial direction in which the head will move, and it will serve in that direction.
- The head responds to each request individually in the direction it is moving.
- The head keeps moving in the same direction until all of the requests in that direction have been serviced.
- If the last request is reached the direction of the head will be reversed. While reversing the direction, all the pending requests will be serviced.
Consider an example,
Suppose the requests to be addressed are 82, 140, 170, 190, 70, 35, and 20. The Head pointer starts at 50, and it is also given that the disk arm should move “towards the larger value”. Calculate the seek time.
Note: Seek time is the time for the disc arm to move the heads to the cylinder containing the desired sector.
The seek time can be calculated as,
Seek time can be calculated by counting the head movements.
OR
By subtracting the last service requests(direction of head pointer) and the head pointer in addition to the last service requests(direction of head pointer) and last service requests(direction opposite to the head pointer).
The seek time can be calculated as,
Advantages
- The performance of the LOOK algorithm is better compared to the SCAN algorithm since it reduces the overhead.
- It can be used in case of less load.
- It does not result in starvation.
- It will provide low variance in response time and waiting time.
Disadvantages
- Look algorithm is not recommended to use in terms of heavy load.
- It causes a long waiting time for the cylinders just visited by the head.