Title: Competitive analysis of the LRFU paging algorithm
1Competitive analysis of the LRFU paging algorithm
- Edith Cohen -- ATT
- Haim Kaplan -- Tel Aviv Univ.
- Uri Zwick -- Tel Aviv Univ.
2Online 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
3LRU and LRU
LRU Evicts the Least Recently Used page
4LRU and LRU
LRU Evicts the Least Recently Used page
5LRU and LRU
LRU Evicts the Least Recently Used page
LFU Evicts the Least Frequently Used page
6Competitive 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 ?
7LRFU? (Lee,Choi,Kim,Noh,Min,Cho,Kim
Sigmetrics99)
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 gt LRFU1 LFU
8LRFU
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) lt 2 and older pages have values
smaller than 1 (ordered by most recent request).
Therefore LRFU
LRU
1
2
9LRFU
3
4
10LRFU
3
4
11LRFU
3
4
7
4
12LRFU
3
4
7
4
13LRFU
3
4
37
16
14LRFU
3
4
37
16
15LRFU
3
4
111
64
16LRFU
3
4
111
64
17LRFU
3
4
3
192
4
256
333
256
18LRFU
3
4
1
3
192
4
256
333
256
19LRFU
3
4
1
3
192
4
256
333
256
20LRFU
3
4
3
4
3
192
4
256
333
3
256
4
21LRFU
3
4
22LRFU
3
4
23LRFU
3
4
7
4
24LRFU
3
4
7
4
25LRFU
3
4
21
16
26LRFU
3
4
21
16
27LRFU
3
4
3
4
63
64
28LRFU
3
4
1
3
4
63
64
29LRFU
3
4
1
3
4
63
64
30LRFU
3
4
3
4
3
3
4
4
63
3
64
4
31LRFU
3
4
3
4
1
63
3
64
4
32LRFU
3
4
3
4
1
63
3
64
4
33LRFU
3
4
9
16
3
4
1
34Observations
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 ?(j1) ?(j3)
?j
35Our result
Let L be an integer such that
?L
gt 1
But,
?L1
? 1
Theorem The competitive ratio of LRFU? is k
L .
36Proof (upper bound). Partition the sequence into
phases.
...
OPT gets at least one miss in each phase
37Proof (upper bound).
Consider the cache after request L1 (in a
phase), for each p ? cache not yet requested in
the phase
?L1
v(p) lt
? 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.
gt at most L k misses in a phase
38Proof (lower bound).
We show a sequence such that LRFU misses kL
times for every miss of OPT
39Proof (lower bound).
Idea Assume there are k1 pages Pumps up v(p),
by requesting it over and over again until
? ?- (L1)
?-L lt v(p) lt
and for every other page pi, v(pi) lt 1.
Now request the page not in LRFUs cache,
(OPT evicts p), and keep requesting the page not
in LRFUs 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.
40Proof (lower bound).
LRFUs cache
p, p2,p3,..pk
p, pk1 p2,p3,..
OPT evicts p
p, pk pk1 p2,p3,..
p, pk-L2... pk pk1 p2,p3,..
pk-L1 p, pk-L2... pk pk1 p2,p3,..
In k-1 more steps p is out
41Open problems
LRFU proves practically useful, LCKNMCK 99.
For which sequences LRFU performs better than LRU
and LFU ?