1 / 20

Stuff iThink that will be on the Quiz/Midterm.

Stuff iThink that will be on the Quiz/Midterm. Page Replacement. by Andrew Yee. What is Page Replacement?. Virtual Memory Memory Management. Why Page Replacement?. Cache is limited. Need ways to manage virtual memory in Cache. How to Page Replace?.

farrah
Download Presentation

Stuff iThink that will be on the Quiz/Midterm.

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Stuff iThinkthat will be on the Quiz/Midterm. Page Replacement by Andrew Yee

  2. What is Page Replacement? Virtual Memory Memory Management

  3. Why Page Replacement? • Cache is limited • Need ways to manage virtual memory in Cache

  4. How to Page Replace? • Cache is limited small, you have to figure out ways to choose which pages to keep in cache. Which you think would most likely be used again in the future . • FIFO and LRU are techniques used to determine which pages should be kept cache. • Optimal is the best possible outcome because you use future knowledge which pages will be used again to determine which pages to keep. • 3 Ways to manage Virtual Memory in Cache • Optimal – Best possible outcome • LRU - Least Recently Used • FIFO - First In First Out Think “Stacks”

  5. How to Represent Pages in Time? Time increases Frame set that can 3 page reference string. Frame cell that can hold a page reference string. CPU issues the page reference string. Think Animated “Stacks”

  6. How to Represent Page Hit and Page Fault (miss)? Time increases Page Hit – Don’t box the frame set Page Fault (miss) – box the frame set Think Animated “Stacks”

  7. Optimal Method • What you need? Requires Future Knowledge.

  8. Example of Optimal Method 1 2 1 3 2 1 4 2 1 4 2 1 4 2 1 4 2 1 4 2 1 4 2 1 4 5 1 4 5 1 4 5 1 4 5 1 4 5 1 5 –Page Fault (Missed) Each of the rectangle is a frame, and each number is a page. Page fault (miss) is when you cant find the page in cache. A hit is when you do find it. You want to minimize the # of miss. Each cell contains a Page.

  9. FIFO – First in First Out Method • How? First Page In First Page Out

  10. Example of FIFO Method 1 2 1 3 2 1 4 3 2 4 3 2 1 4 3 2 1 4 2 1 4 2 1 4 5 2 1 4 5 2 4 5 2 1 4 5 1 4 5 9 –Page Fault (Missed) Each of the rectangle is a frame, and each number is a page. Page fault (miss) is when you cant find the page in cache. A hit is when you do find it. You want to minimize the # of miss. Each cell contains a Page.

  11. LRU – Least Recently Used • Key to this method is: Past experience may indicate future behavior

  12. Example of LRU Method 1 2 1 3 2 1 4 3 2 4 3 2 1 4 3 2 1 4 1 2 4 4 1 2 5 4 1 4 5 1 5 4 1 1 5 4 4 1 5 7 –Page Fault (Missed) Each of the rectangle is a frame, and each number is a page. Page fault (miss) is when you cant find the page in cache. A hit is when you do find it. You want to minimize the # of miss. Each cell contains a Page.

  13. Page Fault Comparison

  14. Practical Method Comparison

  15. Hit Ratio • Hit Ratio = (Total # of Frame Set - # of Page Fault) ---------------------------------------------------- * 100 Total # of Frame Set

  16. Hit Ratio

  17. Practice Example • Compute the hit ratio of each method: • Optimal, FIFO, LRU

  18. Practice Example • Compute the hit ratio of each method: • Optimal 1 3 1 3 6 3 1 4 6 3 Number of Page Fault = 4 Hit ratio = (5 - 4) / 5 * 100 = 20%

  19. Practice Example • Compute the hit ratio of each method: • FIFO 1 3 1 3 1 6 3 1 4 6 3 Number of Page Fault = 4 Hit ratio = (5 - 4) / 5 * 100 = 20%

  20. Practice Example • Compute the hit ratio of each method: • LRU 1 3 1 3 1 6 3 1 4 6 3 Number of Page Fault = 4 Hit ratio = (5 - 4) / 5 * 100 = 20%

More Related