CS FundamentalsHardGATE CS

A clock (second-chance) algorithm has frames f0–f4 holding P3 (R = 1), P8 (R = 0), P5 (R = 1), P1 (R = 1) and P6 (R = 0). The hand points at f2. Two page faults happen in a row with no references in between; a newly loaded page gets R = 1 and the hand moves past it. Which pages are evicted?

  1. A. P8, then P6
  2. B. P6, then P8
  3. C. P6, then P3
  4. D. P8, then P3

Correct answer: B. P6, then P8

From f2: P5 and P1 have R = 1, so their bits are cleared; P6 at f4 has R = 0 and is evicted. The hand moves on to f0: P3's bit is cleared, and P8 at f1 (R = 0) is evicted. Scanning from f0 instead of the hand gives P8 first.

More Operating Systems questions

Exams that ask this topic