{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

14_page_replacement_algorithms_II

14_page_replacement_algorithms_II - LastTime...

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

View Full Document Right Arrow Icon
3/7/12 1 Page Replacement Algorithms and General Design Issues CS372: [email protected] to [email protected] Systems March 7, 2012 Last Time Page Replacement Algorithms FIFO [email protected] LRU LRU [email protected] Clock Enhanced Clock Today More page replacement Enhanced Clock (again!) Effect of increased memory Global vs. local [email protected] Swap Page Sizes Feedback Enhanced Clock/Second Chance Cheaper to replace a page that has not been wriWen since it need not be wriWen back to disk Check both the reference bit and modify bit to determine which page to replace (reference, modify) pairs form classes: (0,0): not used or modified, replace! (0,1): note recently used but modified: OS needs to write, but may not be needed anymore (1,0): recently used and unmodified: may be needed again soon, but doesn’t need to be wriWen (1,1): recently used and modified On page fault, OS searches for page in the lowest nonempty class
Background image of page 1

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

View Full Document Right Arrow Icon
3/7/12 2 Enhanced Clock [email protected] The OS goes around at most three @mes searching for the (0,0) class: 1. If the OS finds (0,0) is replaces that page 2. If the OS finds (0,1) it [email protected] an I/O to write that page, locks the page in memory [email protected] the I/ O completes, clears the modified bit, and [email protected] the search in parallel with the I/O 3. For pages with the reference bit set, the reference bit is cleared 4. On second pass (no page (0,0) found on first), pages that were (0,1) or (1,0) may have changed Enhanced Clock [email protected] (another [email protected]) The OS goes around at most three @mes searching for the (0,0) class: 1. If the OS finds (0,0) is replaces that page 2. If the OS finds (0,1), clear dirty bit and move on, but remember page is dirty. Write only if evicted. 3. For pages with the reference bit set, the reference bit is cleared 4. On second pass (no page (0,0) found on first), pages that were (0,1) or (1,0) may have changed 7 Optimizing Approximate LRU Replacement The Second Chance algorithm There is a significant cost to replacing “dirty” pages Modify the Clock algorithm to allow dirty pages to always survive one sweep of the clock hand Use both the dirty bit and the used bit to drive replacement resident bit used bit dirty bit 0 1 Page 7: 1 5 0 Page 1: 1 3 0 Page 4: 1 4 1 Page 0: 1 9 1 Page 3: 1 0 0 1 0 1 Before clock sweep After clock sweep used dirty 0 0 1 1 0 1 0 1 used dirty 0 0 0 0 0 1 replace page Second Chance Algorithm 8 d c b a c The Second Chance Algorithm Example Faults Page Frames 0 1 2 3
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}