2. Page Replacement :
Want lowest page-fault rate
Evaluate algorithm by running it on a particular string
of memory references & computing the number of page
faults & page replacement on that string.
4. First In First
Out Algorithm
Replace that block
in the set that has
been in the cache
for longest period
of time
FIFO Example
Reference String is :
1,2,5,3,2,4,5,1,2,6
Frame Size=3
1 1 1 3 3 3 3 3 2 2
2 2 2 2 4 4 4 4 6
5 5 5 5 5 1 1 1
Page Fault : 8
5. Least Recently
Used Algorithm
Replace that block
in the set that has
been in the cache
for longest period
of time with no
reference to it
LRU Example
Reference String is :
5,1,2,3,2,4,5,1,7,6
Frame Size=3
5 5 5 5 5 5 5 5 5 5
1 1 3 3 3 3 1 7 7
2 2 2 4 4 4 4 6
Page Fault: 8
6. Optimal
Algorithm
(i) Lowest Page
Fault
(ii)Replace the
page that will
not be used for
the longest
period of time
Optimal Example
Reference String is:
7,0,1,2,0,3,1,4,2,3
Frame Size=3
7 7 7 2 2 2 2 2 2 2
0 0 0 0 3 3 3 3 3
1 1 1 1 1 4 4 4
Page Fault :6