9.4 Optimized Traversal: LOOK & C-LOOK Disk Scheduling
💡 Core Intuition
🍳 The Everyday Analogy: The Smart Delivery Van Driver
Imagine a parcel delivery van traversing a long suburban avenue numbered from House 0 to House 199:
Delivery Route Traversal Optimization Pipeline
Contrasting blind boundary trips with intelligent look-ahead stops
Driving to the Dead-End Turnaround
Under strict SCAN rules, the driver must drive all the way to House 0 at the end of the avenue.
Looking Ahead on the Route
At House 14, the driver checks their route sheet: 'Are there any deliveries further down?'
Circular Shortcut Without Edge Trips
When traveling outward, stop at the highest requested house (183), then take the highway directly to the lowest requested house (14).
- LOOK: Eliminates the boundary waste of SCAN by looking ahead and reversing immediately at the last pending request in the current direction.
- C-LOOK: Eliminates the boundary waste of C-SCAN by bounding the return journey strictly between the highest and lowest pending requests.
💻 Bridging to Computer Science
In both SCAN and C-SCAN, the read/write head mechanically travels to the physical ends of the disk platter (Cylinder and Cylinder ).
In real-world storage controllers, traveling to the physical end of a disk when no request is waiting there is pure wasted mechanical motion.
To optimize head motion, operating systems implement LOOK and C-LOOK:
- Before moving the actuator arm to the next cylinder, the controller looks ahead in the pending request queue.
- If no pending requests exist further along the current direction of travel, the arm reverses direction immediately without visiting the extremity.
📚 Core Deep-Dive & Concepts
1. The LOOK Scheduling Algorithm
Algorithm Mechanics
- The read/write head moves in the designated direction, servicing requests along its trajectory.
- The controller continuously checks the request queue: Are there any pending requests ahead of the current head position in the current direction?
- As soon as the last pending request in that direction is serviced, the actuator arm reverses direction immediately!
- The head never travels to the physical disk boundary ( or ) unless an actual request happens to reside there.
2. Step-by-Step Mathematical Trace: LOOK
- Initial Head Position:
53 - Current Direction: Moving towards lower cylinders (towards
0). - Request Queue:
[ 98, 183, 37, 122, 14, 124, 65, 67 ]
LOOK Disk Head Trajectory
Bounded sweep reversing at lowest pending request (14): 53 → 37 → 14 (Reverse) → 65 → 67 → 98 → 122 → 124 → 183
Total Head Movement Calculation
- SCAN: Traveled from all the way to the physical boundary at ( cylinders).
- LOOK: Traveled from only as far as the lowest pending request at ( cylinders), saving cylinders on the downward pass and cylinders on the upward return—an immediate -cylinder reduction in mechanical wear and seek latency!
3. Circular-LOOK (C-LOOK) Scheduling
Algorithm Mechanics
- The head services requests monotonically in one direction (e.g. towards higher tracks).
- It proceeds only as far as the highest requested cylinder in that direction (). It does not proceed to the physical edge ().
- Once the highest requested cylinder is serviced, the head executes an express return trip directly to the lowest requested cylinder (). It does not return to Cylinder .
- At the lowest requested cylinder, it resumes servicing requests in the original forward direction.
4. Step-by-Step Mathematical Trace: C-LOOK
- Initial Head Position:
53 - Current Direction: Moving towards higher cylinders (towards
199). - Request Queue:
[ 98, 183, 37, 122, 14, 124, 65, 67 ]
C-LOOK (Circular LOOK) Disk Head Trajectory
Upward sweep to highest request (183) with express return to lowest request (14): 53 → 65 → 67 → 98 → 122 → 124 → 183 ⇢ 14 → 37
Total Head Movement Calculation
- C-SCAN Total Movement: Cylinders (swept to physical limits and ).
- C-LOOK Total Movement: Cylinders (bounded strictly by outer requests and ).
- Mechanical Efficiency: Immediate reduction of cylinders ( less actuator movement) with zero starvation risk!
5. The Master 6-Algorithm Comparative Benchmark
Here is the definitive comparative summary of all six fundamental disk scheduling algorithms evaluated on the identical standard benchmark:
| Algorithm | Total Head Movement (Cylinders) | Starvation Risk | Boundary Traversal to or ? | Performance Ranking |
|---|---|---|---|---|
| First-Come, First-Served (FCFS) | Zero () | No | 6th (Worst) | |
| Circular-SCAN (C-SCAN) | Zero () | Yes (Visits both & ) | 5th | |
| Circular-LOOK (C-LOOK) | Zero () | No (Bypasses empty ends) | 4th | |
| SCAN (Elevator) | Zero () | Yes (Visits Cylinder ) | 2nd (Tie) | |
| Shortest Seek Time First (SSTF) | Severe Risk | No | 2nd (Tie, Unstable) | |
| LOOK (Optimized Elevator) | Zero () | No (Reverses at request ) | 1st (Winner!) |
Key Architectural Takeaway:
LOOK achieves the absolute lowest total head movement ( cylinders) while guaranteeing zero starvation, making it the premier real-world scheduling discipline for magnetic disk storage!
🏭 In The Real World: Production Case Study
Modern Enterprise Storage: NCQ (Native Command Queuing) in SATA / SAS
Modern enterprise storage offloads disk scheduling from the OS CPU kernel directly into on-disk DSP microcontrollers:
Native Command Queuing (NCQ) Architecture
Hardware-accelerated rotational and seek optimization inside on-disk controller firmware
Operating System Kernel
On-Board ARM/DSP Microcontroller
Dual Seek + Rotational Optimization (C-LOOK)
- Why Hardware NCQ Outperforms OS Schedulers:
- The OS only knows the cylinder number, not the exact instantaneous angular position of the spinning platter.
- The hard drive's on-board firmware knows the exact microsecond rotational location of the heads.
- Rotational Position Sensing (RPS):
- NCQ evaluates both seek time AND rotational latency simultaneously. If cylinder 98 is 10 tracks away but sector 0 is about to spin under the head, the controller services cylinder 98 before cylinder 65!
🎯 Exam & Interview Pitfall Check
Question 1: What is the fundamental difference between the SCAN algorithm and the LOOK algorithm? Answer:
- SCAN: The actuator arm travels all the way to the physical extremity of the disk (Cylinder or Cylinder ) before reversing direction, regardless of where the last pending request is located.
- LOOK: The actuator arm travels only as far as the final pending request in the current direction, verifies no further requests exist ahead, and reverses immediately without ever visiting the unrequested physical extremity.
Question 2: Trace the LOOK algorithm on a disk with 200 tracks (), starting at track , moving upward towards higher tracks, with pending requests: Calculate the total seek distance. Answer:
- Initial State: Head at , moving upward.
- Upward Sweep:
- Pending higher requests:
82, 140, 170, 190. - Head services: .
- At , look ahead reveals no requests . (Does NOT visit !).
- Upward distance: .
- Pending higher requests:
- Downward Sweep:
- Reverses at and travels downward:
- Services remaining requests: .
- At , look ahead reveals no requests . (Does NOT visit !).
- Downward distance: .
- Total Head Movement:
- The "Visiting Boundary" Trap in LOOK/C-LOOK: Remember: LOOK and C-LOOK NEVER visit Cylinder or unless the request queue explicitly contains or ! If you include or in a LOOK trace, your answer will be marked incorrect.
- The Direction Reversal Calculation Shortcut: Because LOOK sweeps monotonically in each direction, you do not need to add every single individual step: (when starting upward). This formula yields the exact answer in seconds.