ECE344-Lecture19-PageReplacement

ECE344-Lecture19-PageReplacement - Lecture 19: Page...

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

View Full Document Right Arrow Icon
1 Lecture 19: Page Replacement Algorithms David Lie ECE344 University of Toronto
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 ECE344: Operating Systems Overview Introduction Page replacement algorithms Local vs. global page replacement Page buffering Thrashing
Background image of page 2
3 ECE344: Operating Systems Least Recently Used (LRU) A refinement of NRU – NRU picks any unused page – LRU ranks them by how long they have been unused Replace page that has been used least recently – Needs to track how recently a page was used Time 0 1 2 3 4 5 6 7 8 9 10 Requests c a d b e b a b c d Page 0 a Frames 1 b 2 c 3 d Page faults a a a a b b b b c c c c d d d d X a a a a b b b b e e e e d d d d X a b e c X X a b d c X
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 ECE344: Operating Systems LRU Implementation – Option 1 Keep list of all pages in memory Updating the list – When new page is accessed • Add it to front of list – On each memory reference • Move corresponding page to front of list – On a page fault • Choose page at end of list for replacement (least recently used)
Background image of page 4
5 ECE344: Operating Systems LRU Implementation – Option 1 LRU Example Time 0 1 2 3 4 5 6 7 8 9 10 Requests c a d b e b a b c d Page 0 a Frames 1 b 2 c 3 d Page faults a a a a b b b b c c c c d d d d X a a a a b b b b e e e e d d d d X a b e c X X a b d c c a b d a c b d d a c b b d a c e b d a b e d a a b e d b a e d c b a e d c b a
Background image of page 5

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

View Full DocumentRight Arrow Icon
ECE344: Operating Systems LRU Implementation – Option 2 Problem: LRU list is updated on each memory access – Each memory access becomes several accesses! With hardware support, MMU can maintain a counter that is incremented each clock cycle When page is accessed – MMU writes counter value to the page table entry – This timestamp value is the time of last use On a page fault
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 19

ECE344-Lecture19-PageReplacement - Lecture 19: Page...

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

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