Download - ITFN 2601 Introduction to Operating Systems
ITFN 2601Introduction to Operating
Systems
Lecture 15
Page Replacement Algorithms
Agenda
Not Recently UsedFirst In-First Out
Second ChanceClocking
LRUHardware/SoftwareAging
Working Sets
Page Replacement Algorithms
OptimalSwap unnecessary pagesLook forward in time
Find page with longest wait until being usedSwap it outMinimal damage/effect
Unimplementable
Not Recently Used
Not Recently Used00 – Not Referenced, Not Modified01 – Not Referenced, Modified10 – Referenced, Not Modified11 – Referenced, Modified
First bit reset on clock-timerSwap any page from lowest possible
group
First in Algorithms
FIFOSwap the oldest page currently in memoryCould still be very active!
Second ChanceReset “access” bitReset load time
First in, Clocking
ClockMove the clock hand to point to “oldest”
page
Least Recently Used
ListingsMove a page to the front/end of the list each
time it is accessedVery consuming
CounterEach entry gets a “last used” timeEntry with oldest one goes *poof*
More LRU
TableN pagesNxN matrix of bitsEach time page k is used
Row k set to 1’sColumn k set to 0’s
Swap row with the most 0’s
Software LRU
Not Frequently UsedOS maintains countersClock tick => Counter + Read bit Never forgets, old data remains important
AgingShift counter rightAppend Read bit at beginning
Aging example
Working Set
Working setPages used by a process
Working set as a pageBefore the process loads, load the pagesLoad an entire working set at once
If it doesn’t all fit, back to normal paging
OS must track the pages in the working set
PRA’s (Summary)