Understanding Disk Scheduling Algorithms: LOOK, C-LOOK, SCAN, and C-SCAN

Disk scheduling algorithms are essential for optimizing the performance of storage systems. They determine the order in which read/write requests are serviced, minimizing seek time and improving efficiency. Among the most commonly used algorithms are LOOK, C-LOOK, SCAN, and C-SCAN. In this article, we’ll explore the differences between these algorithms, their advantages, and their use cases.
What is Disk Scheduling?
Disk scheduling is a technique used by operating systems to decide the sequence of I/O requests to access the disk. The primary goal is to reduce the seek time (the time taken by the disk arm to move to the desired track) and improve overall system performance.
Key Disk Scheduling Algorithms
1. LOOK Algorithm
- How it works: The LOOK algorithm moves the disk arm in a specific direction (either inward or outward) and services requests along the way. Once there are no more requests in the current direction, it reverses direction.
- Advantages:
- Reduces unnecessary movement compared to SCAN.
- Efficient for systems with moderate request loads.
- Disadvantages:
- Can cause starvation for requests at the far ends of the disk.
2. C-LOOK Algorithm
- How it works: C-LOOK is a variant of LOOK. It services requests in one direction (e.g., inward) and then jumps back to the farthest request in the opposite direction without servicing requests on the return trip.
- Advantages:
- Further reduces seek time compared to LOOK.
- Prevents starvation by ensuring all requests are serviced.
- Disadvantages:
- Slightly more complex to implement than LOOK.
3. SCAN Algorithm (Elevator Algorithm)
- How it works: The SCAN algorithm moves the disk arm from one end of the disk to the other, servicing all requests along the way. Once it reaches the end, it reverses direction.
- Advantages:
- Ensures fairness by servicing requests in both directions.
- Suitable for systems with heavy request loads.
- Disadvantages:
- Can cause longer wait times for requests at the far ends.
4. C-SCAN Algorithm (Circular SCAN)
- How it works: C-SCAN is a variant of SCAN. It moves the disk arm from one end to the other, servicing requests, but instead of reversing direction, it jumps back to the starting end without servicing requests on the return trip.
- Advantages:
- Provides a more uniform wait time compared to SCAN.
- Reduces seek time for requests at the far ends.
- Disadvantages:
- Inefficient for systems with light request loads.
Comparison Table: LOOK, C-LOOK, SCAN, and C-SCAN
Algorithm | Direction | Reverses Direction? | Jumps Back? | Advantages | Disadvantages |
---|---|---|---|---|---|
LOOK | Bi-directional | Yes | No | Reduces unnecessary movement | May cause starvation |
C-LOOK | Uni-directional | No | Yes | Prevents starvation, efficient | Slightly complex |
SCAN | Bi-directional | Yes | No | Fair, handles heavy loads | Longer wait times |
C-SCAN | Uni-directional | No | Yes | Uniform wait time, efficient | Inefficient for light loads |
Summary
- LOOK and C-LOOK are more efficient for moderate request loads, with C-LOOK providing better performance by reducing unnecessary movement.
- SCAN and C-SCAN are better suited for heavy request loads, with C-SCAN offering more uniform wait times.
- The choice of algorithm depends on the system’s workload and performance requirements.
By understanding these disk scheduling algorithms, system administrators can optimize disk I/O operations and improve overall system performance.
Quick RECAP :
1. SCAN (Elevator Algorithm)
Behavior:
- The disk head moves back and forth like an elevator.
- It services requests in one direction until it reaches the last request (either the highest or lowest track). Then it reverses and services requests in the opposite direction.
How to Remember:
- Think of an elevator that stops at all floors with people waiting, going up first, then down.
2. C-SCAN (Circular SCAN)
Behavior:
- The disk head moves in one direction only (e.g., from lowest to highest track).
- Once it reaches the last request, it jumps back to the start without servicing requests in the reverse direction.
How to Remember:
- Imagine a circular elevator that only goes up and teleports to the ground floor to start again.
3. LOOK
Behavior:
- Similar to SCAN, but instead of going to the end of the disk, the head only goes as far as the last request in each direction, then reverses.
How to Remember:
- LOOK stops where requests end. It doesn’t go all the way to the end of the disk.
4. C-LOOK (Circular LOOK)
Behavior:
- Similar to C-SCAN, but the disk head only goes as far as the last request in one direction and jumps back to the beginning without going to the physical end of the disk.
How to Remember:
- Combine the ideas of C-SCAN (circular movement) and LOOK (only goes where requests are).
Key Comparisons
Algorithm | Direction | Stops at End of Disk? | Circular? |
---|---|---|---|
SCAN | Both | Yes | No |
C-SCAN | One-way | Yes | Yes |
LOOK | Both | No (only up to last request) | No |
C-LOOK | One-way | No (only up to last request) | Yes |
Mnemonics to Remember
- “LOOK where requests are.” LOOK and C-LOOK only go as far as the last request.
- “C means Circular.” C-SCAN and C-LOOK restart at the beginning like a loop.
- “SCAN sweeps like an elevator.” It scans back and forth.
- “C-SCAN is one-way only.” Goes up, jumps back to the start.
Read More : What are Wait-Die and Wound-Wait?