NEW-OS-W6-L2-Page Replacement Algorithms
NEW-OS-W6-L2-Page Replacement Algorithms
• Optimal
• easily implemented
• the age of the page is the amount of time the page has
spent in memory
reference string
7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
7 7 7 2 2 2 4 4 4 0 0 0 7 7 7
0 0 0 3 3 3 2 2 2 1 1 1 0 0
1 1 1 0 0 0 3 3 3 2 2 2 1
16
14
12
number of page
10
faults
8
6
4
2
0 1 2 3 4 5 6 7
number of frames
page-fault curve for FIFO replacement on a reference string
AICT004-4-2-OS Operating Systems Page Replacement Algorithms
Slide 10 of 26
Optimal
• Optimal
- replaces the page that will not be used for the longest
period of time
• page (7) will not be used until reference(18) page (0) will
be used at (5) and page (1) at (14)
reference string
7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
7 7 7 2 2 2 2 2 7
0 0 0 0 4 0 0 0
1 1 3 3 3 1 1
7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
7 7 7 2 2 4 4 4 0 1 1 1
0 0 0 0 0 0 3 3 3 0 0
1 1 3 3 2 2 2 2 2 7
• in the worst case, when all bits are set the pointer cycles
through all of the pages, giving each page a second
chance and clears all the bits
• thrashing occurs:
Q&A