Representative Page Address Trace = 1, 6, 4, 5, 1, 4, 3, 2, 1, 2, 1, 4, 6, 7, 4.
Capacity of Main Memory = 4
Let's find out which Page Replacement Policy performs great in the above-mentioned system.
FIFO Page Replacement Policy -
String |
1 |
6 |
4 |
5 |
1 |
4 |
3 |
2 |
1 |
2 |
1 |
4 |
6 |
7 |
4 |
Frame 4 |
|
|
|
5 |
|
|
5 |
5 |
5 |
|
|
4 |
4 |
4 |
|
Frame 3 |
|
|
4 |
4 |
|
|
4 |
4 |
1 |
|
|
1 |
1 |
1 |
|
Frame 2 |
|
6 |
6 |
6 |
|
|
6 |
2 |
2 |
|
|
2 |
2 |
7 |
|
Frame 1 |
1 |
1 |
1 |
1 |
|
|
3 |
3 |
3 |
|
|
3 |
6 |
6 |
|
Miss/Hit |
M |
M |
M |
M |
H |
H |
M |
M |
M |
H |
H |
M |
M |
M |
H |
Page Fault = 10
Page Hits = 5
LRU Page Replacement Policy -
String |
1 |
6 |
4 |
5 |
1 |
4 |
3 |
2 |
1 |
2 |
1 |
4 |
6 |
7 |
4 |
Frame 4 |
|
|
|
5 |
|
|
5 |
2 |
|
|
|
|
2 |
7 |
|
Frame 3 |
|
|
4 |
4 |
|
|
4 |
4 |
|
|
|
|
4 |
4 |
|
Frame 2 |
|
6 |
6 |
6 |
|
|
3 |
3 |
|
|
|
|
6 |
6 |
|
Frame 1 |
1 |
1 |
1 |
1 |
|
|
1 |
1 |
|
|
|
|
1 |
1 |
|
Miss/Hit |
M |
M |
M |
M |
H |
H |
M |
M |
H |
H |
H |
H |
M |
M |
H |
Page Fault = 8
Page Hits = 7
- Based on the number of page faults and the number of page hits we can find out which page replacement policy is the best suitable for the given system.
- The number of page faults in the LRU is lesser than the number of page faults in the FIFO.
$$Page \ Faults \ of \ FIFO \gt Page \ Faults \ of \ LRU$$
$$10 \gt 8$$
- The number of page hits in the LRU has more page hits than in the FIFO.
$$Page \ Hits \ of \ FIFO \lt Page \ Hits \ of \ LRU$$
$$5 \lt 7$$
This shows that LRU Page Replacement is the Best Suitable Policy for the given system.