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?
- A. SCAN, 714 cylinders
- B. SSTF, 713 cylinders
- C. LOOK, 690 cylinders
- 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
- A disk spins at 12,000 RPM, has 250 sectors of 512 bytes per track, an average seek time of 4 ms and a track-to-track seek time of 0.5 ms…
- A machine has 40-bit virtual addresses, 16 KB pages and 4-byte page-table entries. Every page table at every level must fit in a single…
- A 32-bit system uses two-level paging: 10 bits for the outer index, 10 bits for the inner index and a 12-bit offset, with 4-byte entries…
- A 32-bit system uses two-level paging with a 10-bit outer index, a 10-bit inner index and a 12-bit offset. The virtual address 0xC0A8F3E7…
- A system with a TLB and a two-level page table has TLB access time 10 ns (searched before memory), memory access time 100 ns and a TLB hit…
- Memory access takes 200 ns. A page fault takes 8 ms to service if the replaced page is clean and 20 ms if it is dirty, and 40% of replaced…