0
0
Operating Systemsknowledge~15 mins

LOOK and C-LOOK variants in Operating Systems - Deep Dive

Choose your learning style9 modes available
Overview - LOOK and C-LOOK variants
What is it?
LOOK and C-LOOK are disk scheduling algorithms used by operating systems to decide the order in which disk I/O requests are processed. They improve efficiency by reducing the movement of the disk's read/write head. LOOK moves the head back and forth only as far as the last request in each direction, while C-LOOK moves the head in one direction and then jumps back to the start. These algorithms help speed up data access on hard drives.
Why it matters
Without efficient disk scheduling like LOOK and C-LOOK, the disk head would move unnecessarily long distances, causing delays and slower system performance. This would make computers feel sluggish, especially when many programs request data from the disk at once. These algorithms optimize disk usage, making computers faster and more responsive.
Where it fits
Before learning LOOK and C-LOOK, you should understand basic disk operations and simpler scheduling algorithms like FCFS (First-Come, First-Served) and SCAN. After mastering LOOK and C-LOOK, you can explore more advanced disk scheduling methods and how they integrate with modern storage technologies like SSDs.
Mental Model
Core Idea
LOOK and C-LOOK optimize disk head movement by only traveling as far as needed to serve requests, reducing wasted motion and improving speed.
Think of it like...
Imagine a librarian who only walks along the shelves as far as the last book requested, instead of walking all the way to the end every time. LOOK is like walking back and forth between requested books, while C-LOOK is like walking in one direction to the last requested book, then quickly returning to the start without checking shelves on the way back.
Disk requests: 10, 22, 37, 45, 70, 90

LOOK movement:
Start -> 10 -> 22 -> 37 -> 45 -> 70 -> 90 -> back to start

C-LOOK movement:
Start -> 10 -> 22 -> 37 -> 45 -> 70 -> 90 -> jump to 10 (no backward scanning)

┌─────────────┐
│ Disk Track  │
│ 0           │
│ 10 ●        │
│ 22 ●        │
│ 37 ●        │
│ 45 ●        │
│ 70 ●        │
│ 90 ●        │
│ 100         │
└─────────────┘
Build-Up - 7 Steps
1
FoundationUnderstanding Disk Scheduling Basics
🤔
Concept: Disk scheduling decides the order of servicing disk requests to reduce wait time and head movement.
Disks have a read/write head that moves over tracks to access data. Requests come in for different tracks. Without scheduling, the head moves in the order requests arrive, which can cause a lot of unnecessary movement and slow performance.
Result
Recognizing that scheduling can reduce the total distance the head moves, improving speed.
Understanding that the physical movement of the disk head is a major factor in speed helps explain why scheduling matters.
2
FoundationIntroducing SCAN Algorithm
🤔
Concept: SCAN moves the disk head in one direction, servicing requests until it reaches the end, then reverses direction.
Imagine the head moving from the lowest to the highest track, servicing requests along the way, then moving back down. This reduces back-and-forth movement compared to FCFS.
Result
Less total head movement than FCFS, but sometimes the head travels to the end even if no requests are there.
SCAN improves efficiency by grouping requests in one direction but can waste time moving to empty ends.
3
IntermediateLOOK Algorithm Optimization
🤔Before reading on: Do you think LOOK always goes to the disk's end like SCAN, or stops earlier? Commit to your answer.
Concept: LOOK improves SCAN by stopping the head movement at the last request in each direction instead of the disk's end.
Instead of moving all the way to the last track, LOOK moves only as far as the furthest request in the current direction, then reverses. This avoids unnecessary travel to empty tracks.
Result
Reduced head movement compared to SCAN, leading to faster servicing of requests.
Knowing that LOOK trims unnecessary travel helps understand how small changes can improve performance.
4
IntermediateC-LOOK Algorithm Behavior
🤔Before reading on: Does C-LOOK move the head back by scanning in reverse or by jumping? Commit to your answer.
Concept: C-LOOK moves the head in one direction only, then jumps back to the start without servicing requests on the return.
The head moves from the lowest to the highest requested track, servicing requests, then quickly returns to the lowest request without scanning backward. This reduces wait times for requests near the start.
Result
More uniform wait times and less wasted movement compared to LOOK.
Understanding the jump-back behavior explains why C-LOOK can be fairer and faster in some cases.
5
IntermediateComparing LOOK and C-LOOK
🤔Before reading on: Which algorithm do you think provides more uniform wait times, LOOK or C-LOOK? Commit to your answer.
Concept: LOOK scans back and forth, while C-LOOK only scans in one direction and jumps back, affecting wait times and efficiency.
LOOK can cause longer waits for requests just behind the head's current position because it reverses direction. C-LOOK avoids this by always moving forward and jumping back, balancing wait times better.
Result
C-LOOK often provides more consistent response times, while LOOK may be simpler to implement.
Recognizing trade-offs between fairness and simplicity helps in choosing the right algorithm.
6
AdvancedPerformance Impact in Real Systems
🤔Before reading on: Do you think these algorithms matter for SSDs as much as HDDs? Commit to your answer.
Concept: LOOK and C-LOOK optimize mechanical disk head movement, which is less relevant for SSDs but critical for HDDs.
In hard drives, reducing head movement saves time and wear. In SSDs, access times are uniform, so these algorithms have less impact. However, understanding them is key for systems still using HDDs or hybrid storage.
Result
Better system responsiveness and longer disk life on HDDs; less benefit on SSDs.
Knowing hardware differences clarifies when these algorithms are useful.
7
ExpertAlgorithm Adaptations and Limitations
🤔Before reading on: Can LOOK and C-LOOK handle dynamically arriving requests efficiently? Commit to your answer.
Concept: LOOK and C-LOOK can be adapted for dynamic request arrivals but have limitations with real-time constraints and very high loads.
In practice, these algorithms may be combined with priority scheduling or replaced by more complex methods in high-demand systems. They assume a static queue during a scan, which may not hold true, causing delays or starvation.
Result
Understanding these limits guides system designers to choose or modify algorithms for specific workloads.
Knowing the assumptions and limits prevents misuse and helps design better disk schedulers.
Under the Hood
LOOK and C-LOOK work by maintaining a queue of pending disk requests sorted by track number. The disk head moves in one direction, servicing requests in order until it reaches the furthest request in that direction (LOOK) or the highest request (C-LOOK). In LOOK, the head reverses direction after the last request; in C-LOOK, it jumps back to the lowest request without servicing tracks on the return. This reduces unnecessary head movement compared to scanning the entire disk.
Why designed this way?
These algorithms were designed to improve upon SCAN by avoiding wasted movement to empty tracks, which was inefficient. The jump-back in C-LOOK was introduced to provide more uniform wait times and reduce delays for requests near the start. Alternatives like FCFS were simpler but slower, while SCAN was better but still had inefficiencies. LOOK and C-LOOK balance complexity and performance for mechanical disks.
┌───────────────┐
│ Request Queue │
│ Sorted by    │
│ Track Number │
└──────┬────────┘
       │
       ▼
┌─────────────────────────────┐
│ Disk Head Movement Control  │
│                             │
│ LOOK: Move to last request  │
│ then reverse direction      │
│                             │
│ C-LOOK: Move forward to     │
│ last request, then jump back│
└─────────────┬───────────────┘
              │
              ▼
      ┌─────────────┐
      │ Disk Tracks │
      │ 0 - 199     │
      └─────────────┘
Myth Busters - 4 Common Misconceptions
Quick: Does LOOK always scan to the disk's physical end? Commit yes or no.
Common Belief:LOOK always moves the disk head to the very end of the disk before reversing.
Tap to reveal reality
Reality:LOOK only moves as far as the last request in the current direction, not to the disk's physical end.
Why it matters:Believing LOOK scans to the end can lead to overestimating its efficiency and misunderstanding its advantage over SCAN.
Quick: Does C-LOOK scan backward when returning to the start? Commit yes or no.
Common Belief:C-LOOK scans backward over tracks when returning to the start position.
Tap to reveal reality
Reality:C-LOOK jumps back to the start without scanning or servicing requests on the return path.
Why it matters:Thinking C-LOOK scans backward can cause confusion about its efficiency and fairness properties.
Quick: Are LOOK and C-LOOK equally effective on SSDs? Commit yes or no.
Common Belief:LOOK and C-LOOK improve performance equally on all storage devices, including SSDs.
Tap to reveal reality
Reality:These algorithms mainly optimize mechanical head movement, which SSDs do not have, so they offer little benefit on SSDs.
Why it matters:Applying these algorithms blindly to SSDs wastes effort and may complicate scheduling unnecessarily.
Quick: Can LOOK and C-LOOK guarantee no starvation? Commit yes or no.
Common Belief:LOOK and C-LOOK always prevent starvation of disk requests.
Tap to reveal reality
Reality:Under heavy or skewed loads, some requests may wait a long time or starve, especially if new requests keep arriving ahead of the head.
Why it matters:Assuming no starvation can lead to poor system responsiveness and unfairness in real workloads.
Expert Zone
1
LOOK's efficiency depends heavily on the distribution of requests; clustered requests near the ends reduce its advantage.
2
C-LOOK's jump back is a logical jump, not physical, but in HDDs it still involves moving the head quickly, which can cause delays.
3
In multi-queue or priority systems, LOOK and C-LOOK can be combined with priority scheduling, complicating their behavior and performance.
When NOT to use
LOOK and C-LOOK are less effective or unnecessary for SSDs due to lack of mechanical movement. For real-time systems requiring strict deadlines, priority-based or deadline-aware schedulers are better. Also, in systems with very high request rates and dynamic arrivals, more adaptive algorithms like FSCAN or N-step SCAN may be preferred.
Production Patterns
In production, LOOK and C-LOOK are often used in traditional HDD-based storage systems and embedded devices where mechanical wear and latency matter. They are sometimes combined with request merging and caching to further optimize performance. Modern OS kernels may implement variants or hybrids depending on workload characteristics.
Connections
Elevator Algorithm
LOOK and C-LOOK are variants of the Elevator algorithm used in disk scheduling.
Understanding the Elevator algorithm helps grasp how LOOK and C-LOOK improve head movement by limiting unnecessary travel.
Real-Time Scheduling
Disk scheduling algorithms like LOOK and C-LOOK contrast with real-time scheduling which prioritizes deadlines over efficiency.
Knowing the difference clarifies when to prioritize fairness and deadlines versus throughput and efficiency.
Supply Chain Logistics
LOOK and C-LOOK resemble routing strategies in logistics where delivery routes are optimized to minimize travel distance.
Recognizing this connection shows how optimization principles apply across computing and physical delivery systems.
Common Pitfalls
#1Assuming LOOK always scans to disk end causing unnecessary delays.
Wrong approach:Implementing LOOK to always move head to track 0 or max track before reversing, regardless of requests.
Correct approach:Implement LOOK to move head only as far as the last request in the current direction before reversing.
Root cause:Misunderstanding the difference between SCAN and LOOK algorithms.
#2Treating C-LOOK as scanning backward on return path.
Wrong approach:Programming C-LOOK to service requests while moving back to the start track.
Correct approach:Program C-LOOK to jump back to the lowest request without servicing during return.
Root cause:Confusing C-LOOK with LOOK or SCAN behavior.
#3Applying LOOK/C-LOOK scheduling to SSDs expecting performance gains.
Wrong approach:Using LOOK or C-LOOK algorithms in SSD-based systems without considering hardware differences.
Correct approach:Use simpler or different scheduling methods for SSDs since head movement is not a factor.
Root cause:Not accounting for hardware characteristics in algorithm choice.
Key Takeaways
LOOK and C-LOOK are disk scheduling algorithms that reduce disk head movement by only traveling as far as needed to service requests.
LOOK moves the head back and forth between the furthest requests, while C-LOOK moves in one direction and jumps back to the start.
These algorithms improve performance on mechanical hard drives by minimizing wasted movement and balancing wait times.
They are less relevant for SSDs, which have no mechanical head movement, and have limitations under dynamic or real-time workloads.
Understanding their design and trade-offs helps in choosing the right disk scheduling method for different storage systems.