Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE Four Fiddy One Section 7 Kurtis Heimerl Aaron Kimball

Similar presentations


Presentation on theme: "CSE Four Fiddy One Section 7 Kurtis Heimerl Aaron Kimball"— 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.page faults FIFO Laszlo Belady1970

8 Example Page Requests 321032432104

9 Example (Page Faults in Red) Page Requests – 3 frames Frame 1 Frame 2 Frame 3 321032432104 333000444444 22233333111 1112222200

10 Example (Page Faults in Red) Page Requests – 4 frames Frame 1 Frame 2 Frame 3 Frame 4 321032432104 333333444400 22222233334 1111112222 000000111

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


Download ppt "CSE Four Fiddy One Section 7 Kurtis Heimerl Aaron Kimball"

Similar presentations


Ads by Google