Skip to content
We areTOP 1%

Numerical: compute total disk head movement for FCFS, SSTF, SCAN and C-SCAN.

HardConceptOS Numericals
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews

Answer

Problem: a disk has cylinders 0–199. The head is at cylinder 53, moving toward higher numbers, and the queue is 98, 183, 37, 122, 14, 124, 65, 67. Find the total head movement. Answer: FCFS 640, SSTF 236, SCAN 331 and C-SCAN 382 cylinders.

  • Total movement is the sum of distances between consecutive positions; for a one-direction sweep, it is just the distance to the turning point plus the distance back.
  • SCAN goes to the edge (199) before reversing; C-SCAN jumps back to 0 and sweeps up again. Say whether you count the jump, because textbooks differ.
  • LOOK and C-LOOK turn at the last request instead of the edge.

Example (worked solution):

FCFS, order 53, 98, 183, 37, 122, 14, 124, 65, 67: 45 + 85 + 146 + 85 + 108 + 110 + 59 + 2 = 640.

SSTF, order 53, 65, 67, 37, 14, 98, 122, 124, 183: 12 + 2 + 30 + 23 + 84 + 24 + 2 + 59 = 236. At 67, request 37 (30 away) beats 98 (31 away).

SCAN, up to 199 and then down to 14: (199 − 53) + (199 − 14) = 146 + 185 = 331.

C-SCAN, up to 199, jump to 0, then up to 37: 146 + 199 + 37 = 382, or 183 without the jump.

LOOK, up to 183 and then down to 14: (183 − 53) + (183 − 14) = 130 + 169 = 299.

More in OS Numericals

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account