CS FundamentalsVery hardProduct company interview · GATE level

A disk has cylinders 0-499. The head is at 237 and is moving towards cylinder 0. Pending requests: 312, 45, 401, 198, 260, 12, 477, 150, 233. Among FCFS, SSTF, SCAN, LOOK and C-LOOK, which gives the smallest total head movement, and what is it?

  1. A. SCAN, 714 cylinders
  2. B. SSTF, 713 cylinders
  3. C. LOOK, 690 cylinders
  4. D. C-LOOK, 907 cylinders

Correct answer: C. LOOK, 690 cylinders

LOOK: down 237 -> 12 (225 cylinders) serving 233, 198, 150, 45, 12, then up to 477 (465): 690. SCAN goes all the way to 0 first: 237 + 477 = 714. SSTF serves 233, 260, 312, 401, 477 (greedy, nearest first) and then must travel back down to 12: 4 + 27 + 52 + 89 + 76 + 465 = 713. C-LOOK: 225 down, then jump 12 -> 477 (465) and 477 -> 260 (217) = 907. FCFS is 2086. SSTF is greedy and not optimal: the first step towards 233 commits it to sweeping up first, the wrong way.

More Operating Systems questions

Exams that ask this topic