16-1.PageReplacementAlgos

16-1.PageReplacementAlgos - PageReplacementAlgorithms 1...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Page Replacement Algorithms
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Virtual Memory Management Fundamental issues : A Recap Key concept: Demand paging Load pages into memory only when a page fault occurs Issues: Placement strategies Place pages anywhere – no placement policy required Replacement strategies What to do when there exist more jobs than can fit in memory Load control strategies Determining how many jobs can be in memory at one time Operating System Operating System User Program 1 User Program 1 User Program 2 User Program 2 User Program n User Program n ... Memory
Background image of page 2
3 Page Replacement Algorithms Concept Typically Σ i VAS i >> Physical Memory With demand paging, physical memory fills quickly When a process faults & memory is full, some page must be swapped out Handling a page fault now requires 2 disk accesses not 1! Though writes are more efficient than reads (why?) Which page should be replaced? Local replacement     —  Replace a page of the faulting process Global replacement   —  Possibly replace the page of another   process
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Page Replacement Algorithms Evaluation methodology Record a trace of the pages accessed by a process Example: (Virtual) address trace. .. (3,0), (1,9), (4,1), (2,1), (5,3), (2,0), (1,9), (2,4), (3,1), (4,8) generates page trace 3 , 1 , 4 , 2 , 5 , 2 , 1 , 2 , 3 , 4 (represented as c , a , d , b , e , b , a , b , c , d ) Hardware can tell OS when a new page is loaded into the TLB Set a used bit in the page table entry Increment or shift a register Simulate the behavior of a page replacement algorithm on the trace and record the  number of page faults generated fewer faults           better performance
Background image of page 4
5 Optimal Page Replacement Clairvoyant replacement Replace the page that won’t be needed for the longest time in the future c a d b e b a b c d Faults Page Frames 0 1 2 3 a b c d 1 2 3 4 5 6 7 8 9 10 0 Requests Time Time page needed next
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Optimal Page Replacement Clairvoyant replacement Replace the page that won’t be needed for the longest time in the future c a d b e b a b c d a a a a a a a a a d b b b b b b b b b b c c c c c c c c c c Faults Page Frames d d d d e e e e e e 0 1 2 3 a b c d 1 2 3 4 5 6 7 8 9 10 0 Requests Time a = 7 b = 6 c = 9 d = 10 Time page needed next a = 15 b = 11 c = 13 d = 14
Background image of page 6
7 Local Page Replacement FIFO replacement Simple to implement A single pointer suffices Performance with 4 page frames: c a d b e b a b c d Faults Page Frames 0 1 2 3 a b c d 1 2 3 4 5 6 7 8 9 10 0 Requests Time Physical Memory 0 2 3 Frame List
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Local Page Replacement FIFO replacement Simple to implement A single pointer suffices Performance with 4 page frames: c a d b e b a b c d a a a a e e e e e d b b b b b b a a a a c c c c c c c b b b Faults Page Frames d d d d d d d d c c 0 1 2 3 a b c d 1 2 3 4 5 6 7 8 9 10 0 Requests Time Physical Memory 0 2 3 Frame List
Background image of page 8
9 Least Recently Used Page Replacement Use the recent past as a predictor of the near future Replace the page that hasn’t been referenced for the longest time c a d b e b a b c d Faults Page Frames 0 1 2 3 a b c d 1 2 3 4 5 6 7 8 9 10 0 Requests Time Time page last used
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 34

16-1.PageReplacementAlgos - PageReplacementAlgorithms 1...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online