LOOK is a modified version of the SCAN disk scheduling algorithm. In LOOK, the disk head moves in a particular direction until there are no more requests in that direction, then reverses to service requests in the opposite direction. Unlike SCAN, the LOOK algorithm doesn't go all the way to the end of the disk - it only goes as far as the last request in each direction.
How LOOK Works
LOOK is an optimization of the SCAN algorithm that avoids unnecessary movement of the disk head to the ends of the disk when there are no pending requests in those areas.
The algorithm follows these steps:
- The disk arm moves in a particular direction (increasing or decreasing cylinder numbers), servicing all requests in its path
- It continues until there are no more requests in that direction
- The head then reverses its direction and services requests in the opposite direction
- This process continues, going back and forth between directions
Example Calculation
Let's say we have a disk with 200 cylinders (0-199), and the head is currently at position 50, moving towards higher cylinder numbers. The request queue is:
| Request Sequence | 95 | 180 | 34 | 119 | 11 | 123 | 62 |
|---|
The LOOK algorithm will sort these requests based on the current head position and direction of movement:
| Requests Sorted by LOOK Algorithm (Initial Position: 50, Direction: Increasing) | ||||||
|---|---|---|---|---|---|---|
| 62 | 95 | 119 | 123 | 180 | 34 | 11 |
The head movements will be:
| Head Movement | |50-62| | |62-95| | |95-119| | |119-123| | |123-180| | |180-34| | |34-11| |
|---|---|---|---|---|---|---|---|
| Distance | 12 | 33 | 24 | 4 | 57 | 146 | 23 |
Total head movement = 12 + 33 + 24 + 4 + 57 + 146 + 23 = 299 cylinders
Note: Unlike SCAN, LOOK does not go all the way to the end of the disk (cylinder 199) before reversing direction. Instead, it only goes as far as the last request (cylinder 180) in the increasing direction.
Differences Between SCAN and LOOK
- SCAN moves the disk arm to the end of the disk even if there are no requests in that area, while LOOK only moves to the last request in each direction
- LOOK is more efficient in terms of total head movement as it avoids unnecessary travel to the disk boundaries
- LOOK still provides the same directional fairness as SCAN, preventing starvation of requests
- LOOK is easier to implement than C-LOOK as it doesn't require a circular wraparound
Advantages
- Reduces unnecessary head movement compared to SCAN
- Provides better average seek times than SCAN
- Prevents indefinite postponement (starvation) of any request
- Offers good performance for systems with high loads
- Suitable for systems where disk requests are distributed throughout the disk
Disadvantages
- Slightly more complex to implement than simpler algorithms like FCFS
- May not be optimal for all workload patterns
- Does not provide uniform waiting times like C-LOOK
- Requests at the recently-visited end of the disk may have to wait for the head to traverse the entire disk twice