Consider the following reference string: 0, 2, 1, 6, 4, 0, 1, 0, 3, 1, 2, 1.
Using Optimal page replacement algorithm –
Frame\Pages |
0 |
2 |
1 |
6 |
4 |
0 |
1 |
0 |
3 |
1 |
2 |
1 |
Frame 1 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
3 |
3 |
3 |
3 |
Frame 2 |
|
2 |
2 |
2 |
2 |
2 |
2 |
2 |
2 |
2 |
2 |
2 |
Frame 3 |
|
|
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
Frame 4 |
|
|
|
6 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
|
F |
F |
F |
F |
F |
|
|
|
F |
|
|
|
So, total number of page faults = 6.
Consider the following reference string: 0, 2, 1, 6, 4, 0, 1, 0, 3, 1, 2, 1.
Using FIFO page replacement algorithm –
Frame\Pages |
0 |
2 |
1 |
6 |
4 |
0 |
1 |
0 |
3 |
1 |
2 |
1 |
Frame 1 |
0 |
0 |
0 |
0 |
4 |
4 |
4 |
4 |
4 |
4 |
2 |
2 |
Frame 2 |
|
2 |
2 |
2 |
2 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
Frame 3 |
|
|
1 |
1 |
1 |
1 |
1 |
1 |
3 |
3 |
3 |
3 |
Frame 4 |
|
|
|
6 |
6 |
6 |
6 |
6 |
6 |
3 |
3 |
3 |
|
F |
F |
F |
F |
F |
F |
|
|
F |
F |
F |
|
So, total number of page faults =9.