written 7.8 years ago by | • modified 2.9 years ago |
Mumbai University > Computer Engineering > sem 4> computer organization and architecture
Marks: 10M
Year: Dec16
written 7.8 years ago by | • modified 2.9 years ago |
Mumbai University > Computer Engineering > sem 4> computer organization and architecture
Marks: 10M
Year: Dec16
written 7.8 years ago by |
In FIFO page replacement,
when a page is needed to be replaced, we select the oldest page.
4 | 7 | 3 | 0 | 1 | 7 | 3 | 8 | 5 | 4 | 5 | 3 | 4 | 7 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4 | 4 | 4 | 0 | 0 | 0 | 3 | 3 | 3 | 4 | 4 | 4 | 4 | 7 |
7 | 7 | 7 | 1 | 1 | 1 | 8 | 8 | 8 | 8 | 3 | 3 | 3 | |
3 | 3 | 3 | 7 | 7 | 7 | 5 | 5 | 5 | 5 | 5 | 5 | ||
F | F | F | F | F | F | F | F | F | F | F | F |
page fault=14
page hits=2
Here, when a page replacement is needed, it looks ahead in the input queue for the page frame which will be referenced only after a long time. The page with the longest reference is swapped.
4 | 7 | 3 | 0 | 1 | 7 | 3 | 8 | 5 | 4 | 5 | 3 | 4 | 7 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4 | 4 | 4 | 0 | 0 | 0 | 3 | 3 | 3 | 4 | 4 | 4 | 4 | 4 |
7 | 7 | 7 | 1 | 1 | 1 | 8 | 8 | 8 | 8 | 3 | 3 | 3 | |
3 | 3 | 3 | 7 | 7 | 7 | 5 | 5 | 5 | 5 | 5 | 7 | ||
F | F | F | F | F | F | F | F | F | F | F | F |
page fault=12
page hits=2
This method uses the recent past as an approximation of near future. We replace the page which has not been referenced for a long time in the past.
4 | 7 | 3 | 0 | 1 | 7 | 3 | 8 | 5 | 4 | 5 | 3 | 4 | 7 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4 | 4 | 4 | 7 | 3 | 3 | 3 | 0 | 7 | 8 | 8 | 5 | 5 | 4 |
7 | 7 | 3 | 0 | 0 | 0 | 7 | 8 | 5 | 5 | 4 | 4 | 3 | |
3 | 0 | 7 | 7 | 7 | 8 | 5 | 4 | 4 | 3 | 3 | 7 | ||
F | F | F | F | F | F | F | F | F | F |
page fault=10
page hits=4
LRU page replacement algorithm seems to be the best page replacement algorithm as"the no. of page faults are minimum as compared to any page replacement algorithm.