How many page faults occur in LRU page replacement algorithm for the given…
2018
How many page faults occur in LRU page replacement algorithm for the given reference string, with four page frames? 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1
- A.
6
- B.
8
- C.
7
- D.
9
Attempted by 242 students.
Show answer & explanation
Correct answer: C
In Least Recently Used (LRU) page replacement, the page that has not been used for the longest time is replaced. With four page frames, initially all frames are empty. Pages 7, 0, 1, 2 are loaded → 4 page faults
Page 0 already present → no page fault
Page 3 replaces 7 (least recently used) → 1 page fault
Page 0 already present → no page fault
Page 4 replaces 1 → 1 page fault
Pages 2, 3, 0, 3, 2 already present → no page fault
Page 1 replaces 4 → 1 page fault
Pages 2, 0, 1 already present → no page fault
Total page faults = 7