Download presentation
Presentation is loading. Please wait.
Published byRoderick Barnett Modified over 9 years ago
1
1 Competitive analysis of the LRFU paging algorithm Edith Cohen -- AT&T Haim Kaplan -- Tel Aviv Univ. Uri Zwick -- Tel Aviv Univ.
2
2 Online paging problem Get requests to pages You have a cache with k slots 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 Upon a request for page p How do you decide which page to evict ?
3
3 LRU and LRU LRU = Evicts the Least Recently Used page
4
4 LRU and LRU LRU = Evicts the Least Recently Used page LFU = Evicts the Least Frequently Used page
5
5 LRU and LRU LRU = Evicts the Least Recently Used page LFU = Evicts the Least Frequently Used page
6
6 Competitive analysis miss rate (A) competitive ratio(LRU) = k miss rate (OPT) competitive ratio (A) = On the worst- case sequence competitive ratio(LFU) = unbounded Borodin, El Yaniv : Is there a natural algorithm that has a finite competitive ration which is less than k ? Both are good in practice.
7
7 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 (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 ==> LRFU 1 = LFU (a) For every p cache v(p) v(p)
8
8 LRFU Each page p in the cache has a value v(p) Upon a request for a page q we do the following 1 2 1 2 (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 1 2 = LRU
9
9 LRFU 3 4 1
10
10 LRFU 3 4 1
11
11 LRFU 3 4 7 4
12
12 LRFU 3 4 7 4
13
13 LRFU 3 4 37 16
14
14 LRFU 3 4 37 16
15
15 LRFU 3 4 111 64 1
16
16 LRFU 3 4 111 64 1
17
17 LRFU 3 4 333 256 3 4 192 256 =
18
18 LRFU 3 4 333 256 3 4 192 256 = 1
19
19 LRFU 3 4 333 256 3 4 192 256 = 1
20
20 LRFU 3 4 333 256 3 4 192 256 3 4 * * 3 4
21
21 LRFU 3 4 1
22
22 LRFU 3 4 1
23
23 LRFU 3 4 7 4
24
24 LRFU 3 4 7 4
25
25 LRFU 3 4 21 16 1
26
26 LRFU 3 4 21 16 1
27
27 LRFU 3 4 63 64 3 4
28
28 LRFU 3 4 63 64 3 4 1
29
29 LRFU 3 4 63 64 3 4 1
30
30 LRFU 3 4 63 64 3 4 3 4 3 4 * * 3 4
31
31 LRFU 3 4 63 64 1 3 4 * 3 4
32
32 LRFU 3 4 63 64 1 3 4 * 3 4
33
33 LRFU 3 4 9 16 1 3 4
34
34 Observations 1 + + 2 + 3 + 4 + = 1 1- If we request the page over and over again its value approaches If a page has not been requested within the last j requests than its value is smaller than j + (j+1) + (j+3) = 1 1- j
35
35 Our result Let L be an integer such that 1 1- L > 1 1 1- L+1 1 But, Theorem : The competitive ratio of LRFU is k + L. 1 1- > - L 1 1- - ( L+1)
36
Proof (upper bound). Partition the sequence into phases. OPT gets at least one miss in each phase ……...
37
Proof (upper bound). Consider the cache after request L+1 (in a phase), for each p cache not yet requested in the phase 1 1- L+1 1 v(p) < 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 When there are no more pages unrequested since the beginning of the page, phase ends
38
Proof (lower bound). We show a sequence such that LRFU misses k+L times for every miss of OPT
39
Proof (lower bound). Idea: Assume there are k+1 pages Pumps up v(p), by requesting it over and over again until 1 1- - ( L+1) - L < v(p) < and for every other page p i, v(p i ) < 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….
40
Proof (lower bound). LRFU’s cache: p, p 2,p 3,…..p k p, p k+1 p2,p3,….. p, p k p k+1 p2,p3,….. p, p k-L+2 …... p k p k+1 p2,p3,….. OPT evicts p p k-L+1 p, p k-L+2 …... p k p k+1 p2,p3,….. In k-1 more steps p is out
41
41 Open problems For which sequences LRFU performs better than LRU and LFU ? LRFU proves practically useful, LCKNMCK 99.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.