Skip to content

ISRO Scientist/Engineer CSE 2020Operating Systems › Memory Management and Virtual Memory

ISRO Scientist/Engineer CSE 2020 PYQ: Consider the following page reference string. $1\ 2\ 3\ 4\ 2\ 1\ 5\ 6\ 2\ 1\ 2\ 3\ 7\ 6\ 3\ 2\ 1\ 2\ 3\ 6\$…

Consider the following page reference string.

$1\ 2\ 3\ 4\ 2\ 1\ 5\ 6\ 2\ 1\ 2\ 3\ 7\ 6\ 3\ 2\ 1\ 2\ 3\ 6$

What are the minimum number of frames required to get a single page fault for the above sequence assuming LRU replacement strategy?

  1. A
    7
  2. B
    4
  3. C
    6
    Correct answer
  4. D
    5

Answer

(C) $6$

Approach

The string has 7 distinct pages (1,2,3,4,5,6,7), so at least 6 compulsory faults always occur; 'single page fault' must mean only one non-compulsory (extra) fault. Simulating LRU with 6 frames: faults at the first six distinct pages (1,2,3,4,5,6, positions 1–4,7,8 = 6 compulsory), then only page 7 at position 13 faults (evicting page 4, which is never reused), after which the tail 6,3,2,1,2,3,6 all hit — total 7 faults, i.e., exactly one non-compulsory fault. With 5 frames the same trace produces 8 faults (page 7 plus a reload of page 3), so more than one extra fault, and with 4 frames even more. Both 6 and 7 frames yield exactly one non-compulsory fault, so the minimum is 6. Hence answer C (6) is correct; the primary's claim that 6 frames causes multiple non-compulsory faults is a simulation error.

Reviewed by ISRO IQ Editorial Team.