Approximating the Optimal Replacement Algorithm Ben Juurlink.

Slides:



Advertisements
Similar presentations
TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
Advertisements

You have been given a mission and a code. Use the code to complete the mission and you will save the world from obliteration…
Bellwork If you roll a die, what is the probability that you roll a 2 or an odd number? P(2 or odd) 2. Is this an example of mutually exclusive, overlapping,
Advanced Piloting Cruise Plot.
1 Copyright © 2010, Elsevier Inc. All rights Reserved Fig 2.1 Chapter 2.
1 Chapter 40 - Physiology and Pathophysiology of Diuretic Action Copyright © 2013 Elsevier Inc. All rights reserved.
By D. Fisher Geometric Transformations. Reflection, Rotation, or Translation 1.
Analysis of Algorithms
Business Transaction Management Software for Application Coordination 1 Business Processes and Coordination.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
Multiplying binomials You will have 20 seconds to answer each of the following multiplication problems. If you get hung up, go to the next problem when.
0 - 0.
ALGEBRAIC EXPRESSIONS
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
MULTIPLYING MONOMIALS TIMES POLYNOMIALS (DISTRIBUTIVE PROPERTY)
ADDING INTEGERS 1. POS. + POS. = POS. 2. NEG. + NEG. = NEG. 3. POS. + NEG. OR NEG. + POS. SUBTRACT TAKE SIGN OF BIGGER ABSOLUTE VALUE.
MULTIPLICATION EQUATIONS 1. SOLVE FOR X 3. WHAT EVER YOU DO TO ONE SIDE YOU HAVE TO DO TO THE OTHER 2. DIVIDE BY THE NUMBER IN FRONT OF THE VARIABLE.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
FACTORING Think Distributive property backwards Work down, Show all steps ax + ay = a(x + y)
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Addition Facts
ALGEBRAIC EXPRESSIONS
Year 6 mental test 10 second questions Numbers and number system Numbers and the number system, fractions, decimals, proportion & probability.
Around the World AdditionSubtraction MultiplicationDivision AdditionSubtraction MultiplicationDivision.
ZMQS ZMQS
Photo Composition Study Guide Label each photo with the category that applies to that image.
Richmond House, Liverpool (1) 26 th January 2004.
BT Wholesale October Creating your own telephone network WHOLESALE CALLS LINE ASSOCIATED.
1 How to Enter Time. 2 Select: Log In Once logged in, Select: Employees.
SE-292 High Performance Computing
Chapter 4 Memory Management Basic memory management Swapping
ABC Technology Project
CS 241 Spring 2007 System Programming 1 Memory Replacement Policies Lecture 32 Klara Nahrstedt.
Page Replacement Algorithms
Online Algorithm Huaping Wang Apr.21
Cache and Virtual Memory Replacement Algorithms
Chapter 101 The LRU Policy Replaces the page that has not been referenced for the longest time in the past By the principle of locality, this would be.
Chapter 3.3 : OS Policies for Virtual Memory
Virtual Memory 3 Fred Kuhns
Chapter 10: Virtual Memory
Virtual Memory II Chapter 8.
Scribe for 7 th April 2014 Page Replacement Algorithms Payal Priyadarshini 11CS30023.
1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Acknowledgments: Some of the slides are adapted from Prof.
© S Haughton more than 3?
1 Breadth First Search s s Undiscovered Discovered Finished Queue: s Top of queue 2 1 Shortest path from s.
Twenty Questions Subject: Twenty Questions
Linking Verb? Action Verb or. Question 1 Define the term: action verb.
Squares and Square Root WALK. Solve each problem REVIEW:
Energy & Green Urbanism Markku Lappalainen Aalto University.
Past Tense Probe. Past Tense Probe Past Tense Probe – Practice 1.
This, that, these, those Number your paper from 1-10.
Chapter 5 Test Review Sections 5-1 through 5-4.
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
1 First EMRAS II Technical Meeting IAEA Headquarters, Vienna, 19–23 January 2009.
Addition 1’s to 20.
25 seconds left…...
Test B, 100 Subtraction Facts
11 = This is the fact family. You say: 8+3=11 and 3+8=11
Week 1.
Number bonds to 10,
NSCHS College Visit Sign Up Procedure 1.Determine which college(s) you want to sign up to visit with List of college visits are found on the CCC bulletin.
We will resume in: 25 Minutes.
SE-292 High Performance Computing Memory Hierarchy R. Govindarajan
Bottoms Up Factoring. Start with the X-box 3-9 Product Sum
A SMALL TRUTH TO MAKE LIFE 100%
1 Unit 1 Kinematics Chapter 1 Day
Module IV Memory Organization.
Presentation transcript:

Approximating the Optimal Replacement Algorithm Ben Juurlink

Plan Motivation LRU and OPT algorithms Related work TNRP algorithm TNRP tuning TNRP comparison with LRU and OPT

Motivation It takes millions of cycles to serve a page fault Small reduction of the miss rate will pay for the cost of advanced replacement algorithm

LRU Algorithm LRU: Replaces the page that hasnt been used for the longest time The optimal algorithm (OPT) evicts the page that will not be used for the longest time LRU approximates OPT At times LRU is far from optimal: –4 page frames –1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5… –LRUs miss rate: 100% –OPTs miss rate: 40% LRU-2: replaces the page whose second to last access is least recent

Related work: Fiat and Rosen Algorithm Dynamically build weighted access graph An edge is created the first time the two pages are requested in succession Each time the edge is traversed, the weight is decreases by a constant factor Forgetfulness: the weight of all edges multiplied by a constant factor every 10n pages accesses The page to be evicted on a page fault: the furthest page from the page just accessed Expensive algorithm

Time of Next Reference Predictor Three parameters recorded for each page: –TLAST(p) = time of last reference –STRIDE(p) = # of page accesses between the last and previous to last reference –State: Transient initially Steady when –STRIDE(p) – SD STRIDE curr (p) STRIDE(p) + SD (SD = Stride Deviation) –Time – consecutive accesses to one page replaced by one

Time of Next Reference Predictor On a page fault: –Replace a page with the largest expected time of next reference EXP-TNEXT(p) –EXP-TNEXT(t)= TLAST(p) + STRIDE(p) if State=Steady current_time + [current_time – TLAST(p)] if State=Transient

Time of Next Reference Predictor-Example Reference String: SD = 2 Time: Page: Stride: State: T T S T S T T

Time of Next Reference Predictor A correction is needed for EXP-TNEXT (p) –1,2,3,4,5,6,7,8,9,5,11,12,13,14,5,16,17,18,19,5,… –3 pages can be kept in memory –STRIDE(5)=5 –At time 16 13,14 and 5 are in memory EXP-TNEXT (5) = = 20 EXP-TNEXT (13) = 16 + (16 – 13) = 19 EXP-TNEXT (14) = 16 + (16 – 14) = 18 –Page 5 will be evicted

Time of Next Reference Predictor: EXP-TNEXT (p) - solution If the page hasnt been accessed before or the state is transient then –EXP-TNEXT (p) = current_time + TF * (current_time – TLAST(p)) –TF>=1 If the page hasnt been accessed within the expected time current_time > TLAST(p) + STRIDE(p) +SD, use the above formula for EXP-TNEXT(p) and return its state to Transient In our example, take TF=2 –EXP-TNEXT (5) = = 20 –EXP-TNEXT (13) = * (16 – 13) = 22 –EXP-TNEXT (14) = * (16 – 14) = will be evicted

Implementation Issues How to find a victim page –Priority queue (priority = EXP-TNEXT(p)) Takes O(log n) to find a victim page But it takes O(log n) to update the queue –Updates occur frequently –Scan all the paged in pages on a page fault

Experiments - Parameters Benchmarks from the SPEC 2000 suite Stride Deviation: –Investigate the distribution of |STRIDE curr – STRIDE prev | –The distribution depends on benchmark –SD of 5 captures over 60% of all stride values Time of next reference Factor –Check the miss rate for 1<= TF <= 3 with 4 and 8 page frames –Performance rather independent of the exact values 4 page frames, the difference is at most 5% 8 page frames, the difference is at most 0.8% For some benchmarks the miss rate decreases as TF increases For other, it decreases and then increases –Optimal value between 2 and 2.75

Experiments – Miss Rate Reduction TNRP incurs fewer misses than LRU for almost all benchmarks –4 page frames Improvement: Avg: 13.5%, range from 6% to 28.2% –8 page frames Improvement: Avg: 4%, 20.7 for one benchmark –16 page frames Improvement less than 1% for 7 out of 9 benchmarks Double the number of misses for 1 benchmark Performance improvement significant when # of pages is small –Works best in multi-tasking environment when the physical memory needs to be shared among several processes TNRP outperforms LRU-2 for most workloads and number of pages