290 likes | 436 Views
Competitive analysis of the LRFU paging algorithm. Edith Cohen -- AT&T Haim Kaplan -- Tel Aviv Univ . Uri Zwick -- Tel Aviv Univ. How do you decide which page to evict ?. Online paging problem. Get requests to pages. You have a cache with k slots. Upon a request for page p.
E N D
Competitive analysis of the LRFU paging algorithm Edith Cohen -- AT&T Haim Kaplan -- Tel Aviv Univ. Uri Zwick -- Tel Aviv Univ.
How do you decide which page to evict ? Online paging problem Get requests to pages You have a cache with k slots Upon a request for page p if p cache you get a hit. Otherwise you have to put p into the cache and you get a miss Want to minimize the miss rate
LRU and LRU LRU = Evicts the Least Recently Used page
LFU = Evicts the Least Frequently Used page LRU and LRU LRU = Evicts the Least Recently Used page
LRU and LRU LRU = Evicts the Least Recently Used page LFU = Evicts the Least Frequently Used page
Competitive analysis miss rate (A) On the worst-case sequence competitive ratio (A) = miss rate (OPT) competitive ratio(LRU) = k competitive ratio(LFU) = unbounded Both are good in practice. Borodin, El Yaniv : Is there a natural algorithm that has a finite competitive ration which is less than k ?
LRFU (Lee,Choi,Kim,Noh,Min,Cho,Kim Sigmetrics’99) Each page p in the cache has a value v(p) Upon a request for a page q we do the following (a) For every p cache v(p) v(p) (b) If q cache we evict the page with smallest value. We put q in with v(q) = 1. If q cache v(q) = 1 + v(q). =1 ==> LRFU1 = LFU
1 2 LRFU 1 2 Each page p in the cache has a value v(p) Upon a request for a page q we do the following (a) For every p cache v(p) v(p) (b) If q cache we evict the page with smallest value. We put q in with v(q) = 1. If q cache v(q) = 1 + v(q). By induction v(q) < 2 and older pages have values smaller than 1 (ordered by most recent request). Therefore LRFU = LRU 1 2
1 LRFU 3 4
1 LRFU 3 4
LRFU 3 4 7 4
LRFU 3 4 7 4
1 LRFU 3 4 21 16
1 LRFU 3 4 21 16
LRFU 3 4 3 4 63 64
LRFU 3 4 1 3 4 63 64
LRFU 3 4 1 3 4 63 64
LRFU 3 4 3 4 3 3 * 4 4 3 63 * 4 64
LRFU 3 4 3 4 1 3 63 * 4 64
LRFU 3 4 3 4 1 3 63 * 4 64
LRFU 3 4 9 16 3 4 1
1 1 1- 1- Observations If we request the page over and over again its value approaches 1 + + 2 + 3 + 4 + = If a page has not been requested within the last j requests than its value is smaller than j + (j+1) + (j+3) = j
> -L 1 1 1 1 1- 1- 1- 1- -(L+1) Our result Let L be an integer such that L > 1 But, L+1 1 Theorem :The competitive ratio of LRFU is k + L .
Proof (upper bound). Partition the sequence into phases. ……... OPT gets at least one miss in each phase
1 1- Proof (upper bound). Consider the cache after request L+1 (in a phase), for each p cache not yet requested in the phase L+1 v(p) < 1 When there are no more pages unrequested since the beginning of the page, phase ends So each page that gets into the cache after request L stays there until the end of the phase. ==> at most L + k misses in a phase
Proof (lower bound). We show a sequence such that LRFU misses k+L times for every miss of OPT
1 1- Proof (lower bound). Idea: Assume there are k+1 pages Pumps up v(p), by requesting it over and over again until -(L+1) -L < v(p) < and for every other page pi, v(pi) < 1. Now request the page not in LRFU’s cache, (OPT evicts p), and keep requesting the page not in LRFU’s cache. The first L such requests p still has the largest value, then p becomes the second largest, etc, until it gets evicted by LRFU. Repeat this over and over again….
Proof (lower bound). LRFU’s cache: p, p2,p3,…..pk p, pk+1 p2,p3,….. OPT evicts p p, pk pk+1 p2,p3,….. p, pk-L+2…... pk pk+1 p2,p3,….. pk-L+1 p, pk-L+2…... pk pk+1 p2,p3,….. In k-1 more steps p is out
Open problems LRFU proves practically useful, LCKNMCK 99. For which sequences LRFU performs better than LRU and LFU ?