A process has been allocated 3-page frames. Assume that none of the pages of…

2007

A process has been allocated 3-page frames. Assume that none of the pages of the process are available in the memory initially. The process makes the following sequence of page references (reference string):

1, 2, 1, 3, 7, 4, 5, 6, 3, 1

If optimal page replacement policy is used, how many page faults occur for the above reference string?

  1. A.

    7

  2. B.

    8

  3. C.

    9

  4. D.

    10

Attempted by 39 students.

Show answer & explanation

Correct answer: A

The optimal page replacement algorithm replaces the page not needed for the longest time. Starting with empty frames, references 1, 2, and 3 cause faults (count: 3). At reference 7, replace page 2. At 4, replace 7. At 5, replace 4. At 6, replace 5. References 3 and 1 hit existing frames. Total page faults equal 7.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir