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

Least Recently Used (LRU) page replacement policy is a practical approximation to optimal page replacement. For the above reference string, how many more page faults occur with LRU than with the optimal page replacement policy?

  1. A.

    0

  2. B.

    1

  3. C.

    2

  4. D.

    3

Attempted by 12 students.

Show answer & explanation

Correct answer: C

For Optimal policy, faults occur at references 1, 2, 3, 7, 4, 5, and 6 totaling 7 faults. For LRU policy, faults occur at every reference except the initial hits on 1 and 3 totaling 9 faults. The difference between LRU and Optimal page faults is exactly two.

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

Explore the full course: Gate Guidance By Sanchit Sir