E ExamMaster

AP Exams (Advanced Placement) · Operating Systems

Disk scheduling

Disk access time and FCFS, SSTF, SCAN-family head movement.

The head sits at cylinder 50. essay.txt needs blocks at 82, 170, 43 and 140. This lesson adds seek + rotate + transfer (6000 RPM → 5 ms average rotate), then walks that same queue under FCFS (344 cylinders), SSTF (134, with a starvation warning), and the SCAN-family elevators.

  • AP Exams (Advanced Placement)
  • Medium level
  • 4 concepts

1Seek, rotate, transfer

essay.txt's blocks sit on a spinning disk. Reaching one block costs three times added together. Seek time is how long the head takes to move to the right cylinder — usually the largest term, which is why the algorithms below minimise total head movement. Rotational latency is waiting for the right sector to rotate under the head. Transfer time is the reading itself.

A disk at 6000 RPM turns once in 60/6000 = 0.01 s = 10 ms. Average rotational latency is half a turn: 5 ms. Scheduling cannot change the spin; it can only shorten the seek sum.

Figure. Access time ≈ seek + rotational latency + transfer — seek usually dominates random I/O.

Three additive pieces

  1. SeekMove the arm to the cylinder — often the largest cost.
  2. RotateWait for the sector; average latency = half a rotation = (60/\mathrm{RPM})/2 seconds.
  3. TransferCopy the bytes: time = bytes / transfer rate.

Average rotational latency

A disk spins at 6000 RPM. What is the average rotational latency?

  • one rotation = 60/6000 s0.01 s = 10 ms
  • average latency = half a rotation5 ms

Pro tip. Average rotational latency is always half the full rotation time: (60/\mathrm{RPM})/2. Doubling RPM halves the average latency.

Why do disk-scheduling algorithms focus on reducing head movement?
  1. Transfer time dominates access latency on spinning disks
  2. Seek time usually dominates access latency
  3. Rotational latency is independent of which request is served next

Seek dominates, so reordering requests to cut total arm travel pays off. Transfer is usually smaller; rotational cost depends on sector alignment, but the classic scheduling objective is seek distance.

2FCFS disk scheduling

The head sits at cylinder 50. Requests for essay.txt's blocks arrive as 82, 170, 43, 140. FCFS serves them in that arrival order: 50→82→170→43→140.

Movement: |82−50| = 32, |170−82| = 88, |43−170| = 127, |140−43| = 97. Total 32+88+127+97 = 344 cylinders. Fair, simple, and the head zigzags.

Figure. Arrival order forces the long 170 → 43 jump. Positions on the line are schematic — the labelled distances are the teaching content, not pixel-proportional cylinder spacing.

How to compute FCFS movement

  1. Fix the startBegin at the given head cylinder.
  2. Follow arrivalsVisit each request in the order queued — no reordering.
  3. Sum gapsTotal head movement = sum of |current − next| over the path.

FCFS head movement

Disk head at cylinder 50; requests arrive as 82, 170, 43, 140. Total head movement under FCFS?

  • |82 - 50|32
  • |170 - 82|88
  • |43 - 170|127
  • |140 - 43|97
  • total = 32 + 88 + 127 + 97344 cylinders

Pro tip. For FCFS just sum absolute differences between consecutive positions in arrival order. Reordering belongs to SSTF/SCAN — not here.

Coding lab. FCFS head movement from 50 runs in the app, with checks on your output.

Head at 100; FCFS requests 100, 120, 90. Total head movement is
  1. 20
  2. 50
  3. 30

|100-100| + |120-100| + |90-120| = 0 + 20 + 30 = 50 cylinders.

3SSTF and starvation

SSTF (Shortest Seek Time First) always serves the pending request closest to the current head. From 50 the nearest of 82, 170, 43, 140 is 43 (|43−50| = 7). Then 82 (39), then 140 (58), then 170 (30). Total 7+39+58+30 = 134 cylinders — much shorter than FCFS's 344.

The cost is fairness. A steady stream of requests near 80 can starve cylinder 170 forever. SCAN-family algorithms trade a little movement for a bound on that wait.

Figure. SSTF always serves the closest pending request — short local seeks, risk of starvation at the edges.

How SSTF picks the next request

  1. MeasureFrom the current head, compute |head − r| for every pending request.
  2. Take the nearestServe the minimum; ties need a stated rule (either side is fine if the problem specifies).
  3. RepeatUpdate the head and repeat until the queue is empty — then sum the jumps.

SSTF on the same queue

Head at 50; pending requests 82, 170, 43, 140. Total head movement under SSTF?

  • nearest to 50 → 43 (|43-50|=7)7
  • nearest to 43 → 8239
  • nearest to 82 → 14058
  • last → 170; total 7+39+58+30134 cylinders

Pro tip. Same queue as the FCFS example: SSTF drops 344 → 134 cylinders. Locally optimal seek does not imply fairness — watch for starvation wording in MCQs.

SSTF is preferred over FCFS when the goal is minimum total head movement, but SSTF's main drawback is
  1. It cannot serve any request out of arrival order
  2. Far requests may starve if nearer ones keep arriving
  3. It always moves the head to the disk end before reversing

SSTF reorders freely toward the nearest request, so distant cylinders can wait forever. Moving to the disk end is SCAN behaviour, not SSTF.

4SCAN, LOOK, C-SCAN, C-LOOK

SCAN (the elevator) sweeps the head in one direction, serving every request it passes, then reverses. LOOK is SCAN without going to the physical end: reverse at the last pending request in that direction. C-SCAN services in one direction only, then jumps back to the start (or the opposite end) without serving on the return. C-LOOK is the same one-way idea, reversing at the last request rather than the disk end.

The jump back on C-SCAN / C-LOOK is idle — it does not pick up requests. That is the exam distinction from SCAN / LOOK, which serve on both the outbound and the return sweep.

Figure. SCAN/LOOK reverse and keep serving. C-SCAN's return is an idle jump (dashed) so the next sweep starts from the low end with more uniform waiting.

How the elevators differ

  1. SCANSweep one way to the disk end (or until empty), then reverse and sweep the other way.
  2. LOOKLike SCAN, but reverse at the last request in the current direction — no wasted trip to an empty end.
  3. C-SCAN / C-LOOKService only while going one way; jump back to the start (C-SCAN) or to the farthest opposite request (C-LOOK) without serving on the jump.
Elevator family
AlgorithmReverses?Serves on return / jump?Notes
SCANYes, at disk endYes, on the reverse sweepClassic elevator
LOOKYes, at last requestYes, on the reverse sweepSkips empty end cylinders
C-SCANNo — one-way serviceNo — jump is idleMore uniform wait times
C-LOOKNo — one-way serviceNo — jump to outermost requestC-SCAN without empty-end travel
Which statement correctly distinguishes C-SCAN from SCAN?
  1. C-SCAN never moves the head toward higher cylinder numbers
  2. C-SCAN services requests in only one direction, then jumps back without servicing on the return
  3. C-SCAN always starves the innermost cylinders

C-SCAN is one-way service plus an idle jump to the start; SCAN reverses and continues to serve. Direction choice and starvation claims are not the defining contrast.

Notes

  • Disk access time = seek + rotational latency + transfer.
  • Average rotational latency is half a revolution.
  • FCFS serves in arrival order; SSTF serves the nearest pending request.
  • SCAN/LOOK reverse and serve; C-SCAN/C-LOOK serve one way and idle on the return.

Formulas

  • One rotation = 60/\mathrm{RPM} seconds.
  • Average rotational latency = half a rotation.
  • Head movement = sum of absolute cylinder-to-cylinder jumps on the visit path.

Exam traps & shortcuts

  • Score a numerical by listing the visit order first, then summing absolute jumps.
  • SSTF's trap is starvation, not a longer total — the total is usually shorter.

Reference tables

Head at 50. Requests 82, 170, 43, 140.

Same queue, two totals
PolicyVisit orderTotal movement
FCFS82, 170, 43, 140344
SSTF43, 82, 140, 170134

Recap

Access = seek + rotate + transfer. FCFS 344. SSTF 134. C-SCAN does not serve on the return.

Access
Seek dominates. Average rotate = half a turn = (60/RPM)/2.
FCFS
Arrival order. 50→82→170→43→140 = 344.
SSTF
Nearest pending. 50→43→82→140→170 = 134. Can starve a far cylinder.
SCAN / LOOK
Sweep and reverse. LOOK reverses at the last request.
C-SCAN / C-LOOK
One way only. The jump back is idle.

Practise Disk scheduling

Reading is free and needs no account. Practice, mocks and progress live in the app.

  • A 4-question practice set that ends the chapter
  • 4 quick checks with worked explanations
  • Timed mocks scored with the real marking scheme
  • Readiness tracked per topic, kept on your device
Continue with Google — freeNo card, no trial. Works offline once installed.