Computer Science assignments
Homework 5 - Demand paging problems (page replacement algorithms):
1. For the following reference string apply the FIFO page replacement algorithm.
|
Reference string |
2 |
4 |
5 |
6 |
7 |
5 |
1 |
4 |
5 |
2 |
3 |
6 |
5 |
3 |
4 |
5 |
3 |
5 |
6 |
|
Physical frame 0 |
2 |
2 |
2 |
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Physical frame 1 |
|
4 |
4 |
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Physical frame 2 |
|
|
5 |
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Physical frame 3 |
|
|
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Page faults |
F |
F |
F |
F |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Victim frames |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2. For the following reference string apply the OPT page replacement algorithm.
|
Reference string |
2 |
4 |
5 |
6 |
7 |
5 |
1 |
4 |
5 |
2 |
3 |
6 |
5 |
3 |
4 |
5 |
3 |
5 |
6 |
|
Physical frame 0 |
2 |
2 |
2 |
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Physical frame 1 |
|
4 |
4 |
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Physical frame 2 |
|
|
5 |
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Physical frame 3 |
|
|
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Page faults |
F |
F |
F |
F |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Victim pages |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3. For the following reference string apply the LRU page replacement algorithm.
|
Reference string |
2 |
4 |
5 |
6 |
7 |
5 |
1 |
4 |
5 |
2 |
3 |
6 |
5 |
3 |
4 |
5 |
3 |
5 |
6 |
|
Physical frame 0 |
2 |
2 |
2 |
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Physical frame 1 |
|
4 |
4 |
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Physical frame 2 |
|
|
5 |
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Physical frame 3 |
|
|
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Page faults |
F |
F |
F |
F |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Victim pages |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4. For the following reference string apply the LFU page replacement algorithm.
|
Reference string |
2 |
4 |
5 |
6 |
7 |
5 |
1 |
4 |
5 |
2 |
3 |
6 |
5 |
3 |
4 |
5 |
3 |
5 |
6 |
|
Physical frame 0 |
2 |
2 |
2 |
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Physical frame 1 |
|
4 |
4 |
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Physical frame 2 |
|
|
5 |
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Physical frame 3 |
|
|
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Page faults |
F |
F |
F |
F |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Victim pages |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|