A LRU page replacement is used with 4 page frames and eight pages. How many…

2015

A LRU page replacement is used with 4 page frames and eight pages. How many page faults will occur with the reference string 0172327103 if the four frames are initially empty ?

  1. A.

    6

  2. B.

    7

  3. C.

    5

  4. D.

    8

Attempted by 167 students.

Show answer & explanation

Correct answer: B

Solution: Simulate the LRU policy with 4 empty frames for the reference string 0 1 7 2 3 2 7 1 0 3.

  1. Reference 0: miss — load 0. Frames: [0]. Faults = 1.

  2. Reference 1: miss — load 1. Frames: [0, 1]. Faults = 2.

  3. Reference 7: miss — load 7. Frames: [0, 1, 7]. Faults = 3.

  4. Reference 2: miss — load 2. Frames: [0, 1, 7, 2]. Faults = 4.

  5. Reference 3: miss — evict least recently used page 0; load 3. Frames: [3, 1, 7, 2]. Faults = 5.

  6. Reference 2: hit (2 is in frames). Faults = 5.

  7. Reference 7: hit (7 is in frames). Faults = 5.

  8. Reference 1: hit (1 is in frames). Faults = 5.

  9. Reference 0: miss — evict least recently used page 3; load 0. Frames: [0, 1, 7, 2]. Faults = 6.

  10. Reference 3: miss — evict least recently used page 2; load 3. Frames: [0, 1, 7, 3]. Faults = 7.

Total page faults = 7.

Therefore the correct answer is 7 page faults.

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

Explore the full course: Mppsc Assistant Professor