1 / 16

Virtual Memory Page Replacement Algorithms

Overview. Assumptions of Virtual MemoryOverview of ApproachesStatic/Demand Based AlgorithmsDynamic/Prefetch Based AlgorithmsConclusions. Assumptions. TrendsPrincipal of locality ? Program code and data references will often be contiguous, but even if not, will tend to cluster in predictable are

gen
Download Presentation

Virtual Memory Page Replacement Algorithms

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. Virtual Memory Page Replacement Algorithms Terrance McCraw Milwaukee School of Engineering - CS384

    2. Overview Assumptions of Virtual Memory Overview of Approaches Static/Demand Based Algorithms Dynamic/Prefetch Based Algorithms Conclusions

    3. Assumptions Trends Principal of locality – Program code and data references will often be contiguous, but even if not, will tend to cluster in predictable areas Minimize: Extraneous information Thrashing Stackable (not subject to Belady’s Anomaly)

    4. Page Replacement Approaches Static/Demand Policies Operating on the assumption that the page reference stream is unpredictable Bring pages into the primary memory only when they are requested Static Algorithms employ this approach, but use different methods of selecting victim pages

    5. Page Replacement Approaches Dynamic/Prefetch Policies Make an attempt to predict program behavior from past trends Pages can either be demanded, or prefetched if the algorithm expects them to be needed This involves fetching, replacement, and placement policies

    6. Static Page Replacement Optimal replacement theory Belady’s Optimal Algorithm / Perfect Prediction (PP) Only pages replaced are those that will never be needed, or have the longest time before they will be referenced again Not really an algorithm Used as a benchmark for performance comparison Can be applied to very rare cases Full prior knowledge of reference stream Incredibly consistent behavior – systems used for limited applications

    7. Basic Approaches (Touched on in lecture) Random Replacement Not predictable, very rarely useful First-In First-Out Predictable, but not very efficient Sometimes worse performance than random replacement LRU Page that has been around the longest is eliminated

    8. First-In Not-Used First-Out (FIFUFO) Approach Modification to FIFO that uses a referenced bit Single bit approach – if page has been referenced, it is “spared” and the next page in the queue is examined If all bits are set, all bits are reset Efficiency Much more efficient than FIFO Very low hardware cost Is not a Stack algorithm

    9. Least Frequently Used - LFU Approach Frequency of use throughout reference stream (number of times accessed over period of time) Efficiency Frequency since beginning of page reference stream Reacts slowly to locality changes Pages from the new locality eliminated quickly Causes consistent and rapid thrashing during context change Initialization code influence

    10. LFU Continued Efficiency Frequency since page was loaded More efficient, but still somewhat slow responding to locality changes More costly – frequency counts are not over the same interval LFU in general is costly – requires frequency calculations and storage Is a Stack algorithm

    11. Dynamic Page Replacement Global locality encompasses reoccurring “sub localities” At a given time a subset of pages will be operated on Many subsets exist, and may be repeated “Working Set” concept

    12. Working Set Replacement (WSR) Approach Limited number of pages during a lifetime Program allowed to freely page fault during lifetime After lifetime, virtual memory manager “notes” the set of referenced pages Pages no longer a part of the working set are quickly removed Established working set is used for later prefetching

    13. Working Set Replacement (WSR) Efficiency Depends on lifetime Must correspond closely to global locality changes Often adjusted dynamically to follow trends More efficient than demand based in terms of replacement, however much more costly Lifetime calculations Storage of working set references and prefetching

    14. Page-Fault Frequency (PFF) Working set algorithm that uses faulting frequency to determine locality change Point where rate of increase (derivative of the number of page faults) is maximum peaks – hysteresis point Used to control pages allocated to program Hysteresis marks “target” of locality change

    15. Conclusions Static/Demand based paging requires only a replacement policy Relatively low cost LRU and LFU approach Belady’s Optimal Algorithm and stack FIFO and variants do not stack, but can be efficient in limited applications Require much less hardware cost Little to no overhead

    16. Conclusions Dynamic/prefetch requires placement and replacement considerations Working set approach is realistic with global locality changes More versatile than Static algorithms Costly calculations and extra hardware

    17. Conclusions - Overview Static algorithms such as LRU, LFU, and variants are preferred for smaller systems Reliable and consistent, while still responding well to increased resources and limited hardware Dynamic algorithms using the Working Set approach are preferred for larger systems Predict behavior of multiple programs within a global locality Higher cost, but much higher performance Questions?

More Related