A system uses page frames for storing process pages in main memory. It uses the Least Recently Used (LRU) page replacement policy. Assume that all the page frames are initially empty. What is the total number of page faults that will occur while processing the page reference string given below?
View worked solution
Answer: 6
We have initially empty page frames and use the Least Recently Used (LRU) page replacement policy. Let us trace the page reference string step-by-step:
| Step | Reference | Frames (LRU → MRU) | Page Fault? | Remarks |
|---|---|---|---|---|
| 1 | 4 | [4] | Yes (1) | Initial allocation |
| 2 | 7 | [4, 7] | Yes (2) | Initial allocation |
| 3 | 6 | [4, 7, 6] | Yes (3) | Initial allocation |
| 4 | 1 | [7, 6, 1] | Yes (4) | Replaces 4 (LRU) |
| 5 | 7 | [6, 1, 7] | No | Hit |
| 6 | 6 | [1, 7, 6] | No | Hit |
| 7 | 1 | [7, 6, 1] | No | Hit |
| 8 | 2 | [6, 1, 2] | Yes (5) | Replaces 7 (LRU) |
| 9 | 7 | [1, 2, 7] | Yes (6) | Replaces 6 (LRU) |
| 10 | 2 | [1, 7, 2] | No | Hit |
Thus, the total number of page faults that occur is 6.
Free practice · Your answers on this page are not saved.
