Bird
Raised Fist0
Operating Systemsknowledge~10 mins

LOOK and C-LOOK variants in Operating Systems - Step-by-Step Execution

Choose your learning style10 modes available
Concept Flow - LOOK and C-LOOK variants
Start at initial head position
↓
Move head in one direction
↓
Check for requests in that direction
↓
Serve requests
↓
Continue moving
↓
For C-LOOK: jump to furthest request
↓
Repeat until all requests served
The disk head moves in one direction serving requests until none remain, then either reverses (LOOK) or jumps back (C-LOOK) to continue.
Execution Sample
Operating Systems
Requests = [10, 22, 20, 2, 40, 6]
Head = 20
Direction = up

Serve requests in direction until none left
Then reverse (LOOK) or jump (C-LOOK)
Simulates disk head moving to serve requests in one direction, then changing direction or jumping.
Analysis Table
StepHead PositionDirectionRequests ServedAction
120up20Serve request at 20
222up22Serve request at 22
340up40Serve request at 40
440up-No more requests up, LOOK reverses direction to down
510down10Serve request at 10
66down6Serve request at 6
72down2Serve request at 2
82down-No more requests down, all served, STOP
120up20Serve request at 20 (C-LOOK start)
222up22Serve request at 22
340up40Serve request at 40
42up2Jump to lowest request 2, serve 2
56up6Serve request at 6
610up10Serve request at 10
710up-All requests served, STOP
💡 All requests served; LOOK reverses direction when no requests remain in current direction; C-LOOK jumps to lowest request after reaching highest.
State Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4After Step 5After Step 6After Step 7Final
Head Position202022404010622
Direction (LOOK)upupupupdowndowndowndownstop
Requests Served (LOOK)[][20][20,22][20,22,40][20,22,40][20,22,40,10][20,22,40,10,6][20,22,40,10,6,2][20,22,40,10,6,2]
Direction (C-LOOK)upupupupupupupupstop
Requests Served (C-LOOK)[][20][20,22][20,22,40][20,22,40,2][20,22,40,2,6][20,22,40,2,6,10][20,22,40,2,6,10][20,22,40,2,6,10]
Key Insights - 3 Insights
Why does LOOK reverse direction instead of jumping back?
LOOK moves the head back along the track after reaching the last request in one direction, as shown in execution_table steps 4 and 5, to serve remaining requests.
How does C-LOOK differ in handling the head movement after reaching the last request?
C-LOOK jumps directly to the lowest request without reversing, as seen in execution_table step 4 for C-LOOK, skipping empty tracks.
Why are some requests served out of numerical order in C-LOOK?
Because C-LOOK only moves in one direction and jumps back to the lowest request, it serves requests in ascending order from the jump point, not reversing direction.
Visual Quiz - 3 Questions
Test your understanding
Looking at the execution_table, what is the head position at step 3 for LOOK?
A22
B40
C10
D6
💡 Hint
Check the 'Head Position' column at step 3 in the LOOK part of the table.
At which step does LOOK reverse direction?
AStep 3
BStep 5
CStep 4
DStep 7
💡 Hint
Look at the 'Action' column where it mentions reversing direction.
In C-LOOK, after serving the highest request, what happens next?
AHead jumps to lowest request
BHead reverses direction
CHead stops
DHead moves to middle request
💡 Hint
See the action at step 4 in the C-LOOK section of the execution_table.
Concept Snapshot
LOOK and C-LOOK are disk scheduling algorithms.
LOOK moves the head in one direction serving requests until none remain, then reverses.
C-LOOK moves in one direction and jumps back to the lowest request without reversing.
Both reduce unnecessary head movement compared to SCAN.
Useful for optimizing disk access time.
Full Transcript
This visual execution shows how LOOK and C-LOOK disk scheduling algorithms work. The disk head starts at a position and moves in one direction serving requests. LOOK continues until no requests remain in that direction, then reverses to serve remaining requests. C-LOOK, instead of reversing, jumps back to the lowest request and continues moving in the same direction. The execution table traces each step, showing head position, direction, requests served, and actions taken. Variable tracking shows how head position and direction change over time. Key moments clarify why LOOK reverses and C-LOOK jumps. The quiz tests understanding of head positions and direction changes. This helps beginners see how these algorithms reduce disk head movement and improve efficiency.

Practice

(1/5)
1. What is the main difference between the LOOK and C-LOOK disk scheduling algorithms?
easy
A. LOOK moves only in one direction, while C-LOOK moves back and forth.
B. LOOK uses a queue, while C-LOOK uses a stack.
C. LOOK schedules requests randomly, while C-LOOK schedules them sequentially.
D. LOOK moves the disk head back and forth, while C-LOOK moves in one direction and jumps back.

Solution

  1. Step 1: Understand LOOK algorithm movement

    LOOK moves the disk head back and forth servicing requests only as far as needed in each direction.
  2. Step 2: Understand C-LOOK algorithm movement

    C-LOOK moves the disk head in one direction only and jumps back to the start without servicing requests on the return.
  3. Final Answer:

    LOOK moves the disk head back and forth, while C-LOOK moves in one direction and jumps back. -> Option D
  4. Quick Check:

    LOOK vs C-LOOK movement = back/forth vs one-way jump [OK]
Hint: LOOK moves back/forth; C-LOOK jumps back after one-way move [OK]
Common Mistakes:
  • Confusing direction of head movement
  • Thinking C-LOOK moves back and forth
  • Mixing up scheduling order
2. Which of the following is the correct way to describe the C-LOOK algorithm's disk head movement?
easy
A. The head moves back and forth servicing all requests.
B. The head moves in one direction and then jumps back to the first request.
C. The head moves randomly to service requests.
D. The head moves in a circular queue servicing requests in order.

Solution

  1. Step 1: Identify C-LOOK movement pattern

    C-LOOK moves the disk head in one direction only, servicing requests along the way.
  2. Step 2: Understand jump back behavior

    After reaching the last request in that direction, the head jumps back to the first request without servicing on the return.
  3. Final Answer:

    The head moves in one direction and then jumps back to the first request. -> Option B
  4. Quick Check:

    C-LOOK = one-way move + jump back [OK]
Hint: C-LOOK moves one way, then jumps back to start [OK]
Common Mistakes:
  • Assuming head moves back and forth
  • Confusing C-LOOK with LOOK
  • Thinking head services requests on return jump
3. Given the disk requests at positions [10, 22, 20, 2, 40, 6] and the disk head starting at position 15 moving towards higher numbers, what is the order of servicing requests using the LOOK algorithm?
medium
A. [20, 22, 40, 10, 6, 2]
B. [20, 22, 40, 6, 2, 10]
C. [20, 22, 40, 6, 2]
D. [20, 22, 40, 10, 2, 6]

Solution

  1. Step 1: Move head towards higher requests

    Starting at 15, LOOK moves up servicing 20, 22, and 40.
  2. Step 2: Reverse direction and service lower requests

    After 40, head moves back down servicing 10, 6, and 2. But LOOK only goes as far as the last request in each direction. Since 10 is before 15, it will be serviced on the return.
  3. Step 3: Verify options

    [20, 22, 40, 6, 2] lists only requests serviced in one direction (20, 22, 40) without the return. LOOK services both directions, so [20, 22, 40, 6, 2] is incomplete. [20, 22, 40, 10, 6, 2] includes 10, 6, 2 after 40, which matches LOOK behavior.
  4. Final Answer:

    [20, 22, 40, 10, 6, 2] -> Option A
  5. Quick Check:

    LOOK = up then down servicing all requests [OK]
Hint: LOOK moves up then down servicing requests in both directions [OK]
Common Mistakes:
  • Ignoring requests on return path
  • Assuming C-LOOK behavior
  • Ordering requests incorrectly
4. Identify the error in this description of the C-LOOK algorithm: "The disk head moves from the lowest to the highest request, then moves back servicing requests on the return path."
medium
A. C-LOOK does not move back to service requests; it jumps back without servicing.
B. C-LOOK services requests randomly, not in order.
C. C-LOOK moves back and forth like LOOK, so the description is correct.
D. C-LOOK only services the lowest request and stops.

Solution

  1. Step 1: Understand C-LOOK movement

    C-LOOK moves the head in one direction servicing requests from lowest to highest.
  2. Step 2: Check return path behavior

    Unlike LOOK, C-LOOK does not service requests on the return jump; it jumps back to the start without servicing.
  3. Final Answer:

    C-LOOK does not move back to service requests; it jumps back without servicing. -> Option A
  4. Quick Check:

    C-LOOK jump back skips servicing requests [OK]
Hint: C-LOOK jump back skips servicing requests [OK]
Common Mistakes:
  • Assuming servicing on return jump
  • Confusing C-LOOK with LOOK
  • Misunderstanding head movement direction
5. A disk has requests at positions [5, 15, 25, 35, 45] and the head is currently at position 20 moving towards higher numbers. Using the C-LOOK algorithm, what is the total distance the disk head will move to service all requests?
hard
A. 50
B. 40
C. 35
D. 60

Solution

  1. Step 1: Service requests moving up from 20

    The head moves from 20 to 25, then 35, then 45. Distance = 45 - 20 = 25.
  2. Step 2: Jump back to lowest request and service upwards

    After 45, the head jumps back to 5 (distance = 45 - 5 = 40, but jump is not counted as movement in C-LOOK). Then it services 5 and 15 moving up. Distance from 5 to 15 = 10.
  3. Step 3: Calculate total movement

    Total movement = 25 (upwards) + 10 (from 5 to 15) = 35. But jump back is considered instantaneous (no movement counted). So total movement is 25 + 10 = 35.
  4. Step 4: Re-examine options

    Total movement of 35 matches 35.
  5. Final Answer:

    35 -> Option C
  6. Quick Check:

    C-LOOK counts only servicing moves, jump back ignored [OK]
Hint: Count only servicing moves; ignore jump back distance [OK]
Common Mistakes:
  • Counting jump back as movement
  • Ignoring requests before head position
  • Adding distances incorrectly
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard