lec12-PageReplaceAndDisks

lec12-PageReplaceAndDisks - Paging Policies CSE120...

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

View Full Document Right Arrow Icon
1 CSE120 Principles of Operating Systems Prof Yuanyuan (YY) Zhou Lecture 12: Page Replacement & Disks Nov 9, 2010 November 8, 2010 CSE 120 2 Paging Policies Fetch Strategies When should a page be brought into primary (main) memory from secondary (disk) storage. Placement Strategies When a page is brought into primary storage, where is it to be put? Replacement Strategies Which page now in primary storage is to be removed from primary storage when some other page or segment is to be brought in and there is not enough room. November 8, 2010 CSE 120 3 Issue: Eviction Hopefully, kick out a less-useful page Dirty pages require writing, clean pages don’t Hardware has a dirty bit for each page frame indicating this page has been updated or not Where do you write? To “swap space” Goal: kick out the page that’s least useful Problem: how do you determine utility? Kick out pages that aren’t likely to be used again Heuristic: temporal locality exists November 8, 2010 CSE 120 4 Page Replacement Strategies The Principle of Optimality Replace the page that will not be used again the farthest time in the future. Random page replacement Choose a page randomly FIFO - First in First Out Replace the page that has been in primary memory the longest LRU - Least Recently Used Replace the page that has not been used for the longest time LFU - Least Frequently Used Replace the page that is used least often NRU - Not Recently Used An approximation to LRU. Working Set Keep in memory those pages that the process is actively using.
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 November 8, 2010 CSE 120 5 Belady’s Algorithm Known as the optimal page replacement algorithm because it has the lowest fault rate for any page reference stream/sequence Idea: Replace the page that will not be used for the longest time in the future Problem: Have to predict the future Why is Belady’s useful then? Use it as a yardstick Compare implementations of page replacement algorithms with the optimal to gauge room for improvement If optimal is not much better, then algorithm is pretty good If optimal is much better, then algorithm could use some work Random replacement is often the lower bound November 8, 2010 CSE 120 6 Optimal Example 12 references, 7 faults Hit Ratio: 5/12 Miss Ratio: 7/12 Evict c (farthest in the future) November 8, 2010 CSE 120 7 First-In First-Out (FIFO) FIFO is an obvious algorithm and simple to implement Maintain a list of pages in order in which they were paged in On replacement, evict the one brought in longest time ago Why might this be good? Maybe the one brought in the longest ago is not being used Why might this be bad? Then again, maybe it’s not
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.

This note was uploaded on 12/09/2010 for the course CSE CSE 120 taught by Professor Yuanyuanzhou during the Spring '10 term at UCSD.

Page1 / 11

lec12-PageReplaceAndDisks - Paging Policies CSE120...

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

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