1 / 24

CSE Four Fiddy One

CSE Four Fiddy One. Section 7 Kurtis Heimerl (kheimerl@) Aaron Kimball (ak@). What you’ve luckily skipped:. Project 3 - Your job: Replacement Algorithms Given: random You need to write: FIFO LRU Clock One of your choice A few possibilities: True LRU (e.g. via storing full timestamp)

june
Download Presentation

CSE Four Fiddy One

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. CSE Four Fiddy One Section 7 Kurtis Heimerl (kheimerl@) Aaron Kimball (ak@)

  2. What you’ve luckily skipped: • Project 3 - Your job: Replacement Algorithms • Given: • random • You need to write: • FIFO • LRU Clock • One of your choice • A few possibilities: • True LRU (e.g. via storing full timestamp) • Variations on LRU Clock (enhanced second-chance, etc) • LFU/MFU • Your own! • You can write more than 3 if your experiment focuses on replacement algorithms. So we’ll go over some aspects of this you may have missed.

  3. Paging Algorithms(Thanks wikipedia!) • FIFO (First in/first out) • Replace the oldest page with the one being paged in • Second-Chance (Modified FIFO) • FIFO, but skip referenced pages • Random • Duh • NFU (Not Frequently Used) • Replace the page used the least number of times • NRU (Not Recently Used) • Replace a page not used since last clock cycle • LRU (Least Recently Used) • Replace the least recently used page • LRU Clock (Modified LRU) • Replace the least recently used page, with a hard limit on the max time since used • Clairvoyant • Replace the page that’s going to be needed farthest in the future.

  4. FIFO • First in/First out • Advantages? • Problems?

  5. FIFO • First in/First out • Advantages? • Little Bookkeeping • Problems? • Efficiency • Why?

  6. FIFO • First in/First out • Advantages? • Little Bookkeeping • Problems? • Efficiency • Why? • Belady's anomaly • What is it?

  7. Belady's anomaly Belady's anomaly states that it is possible to have more page faults when increasing the number of page frames while using FIFO method of frame management. Laszlo Belady demonstrated this in 1970. Previously, it was believed that an increase in the number of page frames would always provide the same number or fewer page faults.

  8. Example Page Requests 321032432104

  9. Example (Page Faults in Red) Page Requests – 3 frames Frame 1 Frame 2 Frame 3

  10. Example (Page Faults in Red) • Page Requests – 4 frames • Frame 1 • Frame 2 • Frame 3 • Frame 4

  11. Second-Chance FIFO • Simply add a referenced bit to FIFO pages. • Advantages? • Disadvantages?

  12. Second-Chance FIFO • Simply add a referenced bit to FIFO pages. • Advantages? • Obvious improvement over FIFO • Allows commonly used pages to stay in queue • Disadvantages? • Still suffers from Belady's anomaly

  13. Random • Randomly Select a page to be replaced • Advantages? • Disadvantages?

  14. Random • Randomly Select a page to be replaced • Advantages? • Usually better than FIFO • Better than LRU in some degenerate cases (looping) • Easy to implement • Disadvantages? • Less than efficient in most common cases

  15. NFU (Not Frequently Used) • Remove the page used the least number of total times • Advantages? • Disadvantages?

  16. NFU (Not Frequently Used) • Remove the page used the least number of total times • Advantages? • Frequently used pages stay longer than FIFO • Disadvantages? • Older pages are less likely to be removed, even if they are no longer frequently used • Newer pages are more likely to be replaced even if they are frequently used

  17. NRU (Not Recently Used) • Remove the page used the least often since the last clock cycle • Advantages? • Disadvantages?

  18. NRU (Not Recently Used) • Remove the page used the least often since the last clock cycle • Advantages? • Much better behavior than FIFO or NFU • Frequently used pages are much more likely to stay • Disadvantages? • Behavior sucks near clock cycles

  19. LRU (Least Recently Used) • Remove the page not used for the longest period of time • Advantages? • Disadvantages?

  20. LRU (Least Recently Used) • Remove the page not used for the longest period of time • Advantages? • Great efficiency behavior • Disadvantages? • Implementation difficult. How do you keep track of the time each page was last used?

  21. LRU Clock (Modified LRU) • Remove the page with the longest time since it’s use, with a hard cap on that time. • Advantages? • Disadvantages?

  22. LRU Clock (Modified LRU) • Remove the page with the longest time since it’s use, with a hard cap on that time. • Advantages? • Very close approximation of LRU • Cap on hardware resources needed • Disadvantages? • Still not optimal

  23. Clairvoyant • Remove the page that will be needed farthest in the future • Advantages? • Disadvantages?

  24. Clairvoyant • Remove the page that will be needed farthest in the future • Advantages? • Optimal • Disadvantages? • Impossible to implement

More Related