Consider a demand paging system with four-page frames (initially empty) and LRU page replacement policy. For the following page reference string
7, 2, 7, 3, 2, 5, 3, 4, 6, 7, 7, 1, 5, 6, 1
the page fault rate, defined as the ratio of number of page faults to the number of memory accesses (rounded off to one decimal place) is_________.
Correct Answer:
0.6
Solution:
String Reference | Frame 1 | Frame 2 | Frame 3 | Frame 4 | Hit/Miss |
7 | 7 | Miss | |||
2 | 7 | 2 | Miss | ||
7 | 7 | 2 | Hit | ||
3 | 7 | 2 | 3 | Miss | |
2 | 7 | 2 | 3 | Hit | |
5 | 7 | 2 | 3 | 5 | Miss |
3 | 7 | 2 | 3 | 5 | Hit |
4 | 4 | 2 | 3 | 5 | Miss |
6 | 4 | 6 | 3 | 5 | Miss |
7 | 4 | 6 | 3 | 7 | Miss |
7 | 4 | 6 | 3 | 7 | Hit |
1 | 4 | 6 | 1 | 7 | Miss |
5 | 5 | 6 | 1 | 7 | Miss |
6 | 5 | 6 | 1 | 7 | Hit |
1 | 5 | 6 | 1 | 7 | Hit |
No. Of Page Faults = 9
No. Of Memory Access = 15
The ratio of no. page faults to no. of memory access is 9/15 = 0.6