12
ITFN 2601 Introduction to Operating Systems Lecture 15 Page Replacement Algorithms

ITFN 2601 Introduction to Operating Systems

Embed Size (px)

DESCRIPTION

ITFN 2601 Introduction to Operating Systems. Lecture 15 Page Replacement Algorithms. Agenda. Not Recently Used First In-First Out Second Chance Clocking LRU Hardware/Software Aging Working Sets. Page Replacement Algorithms. Optimal Swap unnecessary pages Look forward in time - PowerPoint PPT Presentation

Citation preview

Page 1: ITFN 2601 Introduction to Operating Systems

ITFN 2601Introduction to Operating

Systems

Lecture 15

Page Replacement Algorithms

Page 2: ITFN 2601 Introduction to Operating Systems

Agenda

Not Recently UsedFirst In-First Out

Second ChanceClocking

LRUHardware/SoftwareAging

Working Sets

Page 3: ITFN 2601 Introduction to Operating Systems

Page Replacement Algorithms

OptimalSwap unnecessary pagesLook forward in time

Find page with longest wait until being usedSwap it outMinimal damage/effect

Unimplementable

Page 4: ITFN 2601 Introduction to Operating Systems

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

Page 5: ITFN 2601 Introduction to Operating Systems

First in Algorithms

FIFOSwap the oldest page currently in memoryCould still be very active!

Second ChanceReset “access” bitReset load time

Page 6: ITFN 2601 Introduction to Operating Systems

First in, Clocking

ClockMove the clock hand to point to “oldest”

page

Page 7: ITFN 2601 Introduction to Operating Systems

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*

Page 8: ITFN 2601 Introduction to Operating Systems

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

Page 9: ITFN 2601 Introduction to Operating Systems

Software LRU

Not Frequently UsedOS maintains countersClock tick => Counter + Read bit Never forgets, old data remains important

AgingShift counter rightAppend Read bit at beginning

Page 10: ITFN 2601 Introduction to Operating Systems

Aging example

Page 11: ITFN 2601 Introduction to Operating Systems

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

Page 12: ITFN 2601 Introduction to Operating Systems

PRA’s (Summary)