Page 1

On the relative dominance of paging algorithms$,$$

Reza Dorrigiv∗

Alejandro L´ opez-Ortiz

J. Ian Munro

Cheriton School of Computer Science, University of Waterloo, Waterloo, Ont., N2L

3G1, Canada

Abstract

In this paper we give a finer separation of several known paging algorithms

using a new technique called relative interval analysis. This technique com-

pares the fault rate of two paging algorithms across the entire range of inputs

of a given size rather than in the worst case alone. Using this technique we

characterize the relative performance of LRU and LRU-2, as well as LRU and

FWF, among others. We also show that lookahead is beneficial for a paging

algorithm, a fact that is well known in practice but it was, until recently, not

verified by theory.

Key words: Competitive Analysis, Fault Rate, Online Algorithms, Paging

1. Introduction

Paging is a fundamental problem in the context of the analysis of online

algorithms.A paging algorithm mediates between a slower and a faster

memory. Assuming a cache of size k, the algorithm decides which k memory

$A preliminary version of this paper appeared at ISAAC2007 [1].

$$This work was supported by NSERC of Canada and the Canada Research Chairs

Program.

∗Corresponding author

Email addresses: rdorrigiv@uwaterloo.ca (Reza Dorrigiv),

alopez-o@uwaterloo.ca (Alejandro L´ opez-Ortiz), imunro@uwaterloo.ca (J. Ian

Munro)

Preprint submitted to Theoretical Computer ScienceMarch 10, 2009

Page 2

pages to keep in the cache without the benefit of knowing in advance the

sequence of upcoming page requests. After receiving the ith page request the

online algorithm must decide which page to evict, in the event the request

results in a fault and the cache is full. The objective is to design efficient

online algorithms in the sense that on a given request sequence the total cost,

namely the total number of faults, is kept low. Three well known paging

algorithms are Least-Recently-Used (LRU), First-In-First-Out (FIFO), and

Flush-When-Full (FWF). On a fault, if the cache is full, LRU evicts the page

that is least recently requested, FIFO evicts the page that is first brought to

the cache, and FWF empties the cache.

The competitive ratio, first introduced formally by Sleator and Tarjan [2],

has served as a practical measure for the study and classification of online

algorithms. An algorithm (assuming a cost-minimization problem) is said to

be α-competitive if the cost of serving any specific request sequence never

exceeds α times the optimal cost (up to some additive constant) of an op-

timal offline algorithm which knows the entire sequence. The competitive

ratio has been applied to a variety of online problems and settings: it is rel-

atively simple measure to apply yet powerful enough to quantify, to a large

extent, the performance of many an online algorithm. On the other hand,

it has been observed by numerous researchers [3, 4, 5, 6, 7, 8] that for pag-

ing it produces results that are too pessimistic or otherwise found wanting.

For example, experimental studies show that LRU has a performance ratio

at most four times the optimal offline algorithm [6, 9], as opposed to the

competitive ratio k predicted by competitive analysis. Furthermore, it has

been empirically well established that LRU (and/or variants thereof) most

often are, in practice, preferable paging strategies to all other known paging

algorithms [10]. This is in contrast to competitive analysis in which the com-

petitive ratio of LRU is the same as FWF and worse than some randomized

algorithms. An additional drawback of competitive analysis, as can easily be

shown [11], is that finite lookahead yields no improvement in the performance

of an online algorithm. Once again, this is a rather counterintuitive conclu-

sion: in practice, one expects that lookahead should improve performance,

and a “reasonable” theoretical measure should reflect this reality.

Such anomalies have been observed since the early days of competitive

analysis, and there is a vast literature studying alternative proposals to the

competitive analysis of online algorithms in general, and for the paging prob-

lem in particular, e.g., [3, 7, 12, 13, 14, 5, 15, 16] (see [17] for a comprehensive

survey). Note that competitive analysis uses the concept of an optimal of-

2

Page 3

fline algorithm as a baseline for comparing online algorithms. While this may

be convenient, it is rather indirect: one could argue that in comparing two

online algorithms, all we need to study is the relative cost of the algorithms

on the request sequences. The approach we follow in this paper stems from

this basic observation. Furthermore, our definition focuses not on a specific

worst case request sequence, but rather on the performance of an algorithm

on all possible sequences.

We briefly review some of these alternatives and refer the reader to the

survey of Dorrigiv and L´ opez-Ortiz [17] for a more comprehensive and de-

tailed exposition. Loose competitiveness, which was first proposed by Young

in [6] and later refined in [18], considers an offline adversary that is oblivious

to the cache size k. The adversary must then produce a sequence that is

bad for most values of k rather than for just a specific value. It also ignores

those sequences on which the online algorithm incurs a cost less than a cer-

tain threshold. This results in a weaker adversary and gives rise to paging

algorithms of constant performance ratio. The diffuse adversary model by

Koutsoupias and Papadimitriou [5] as well as Young [19, 15] refines the com-

petitive ratio by restricting the set of legal request sequences to those derived

from a class (family) of probability distributions. This restriction follows

from the observation that although a good performance measure could in

fact use the actual distribution over the request sequences, determining the

exact distribution of real-life phenomena is a difficult task (e.g., depending on

the intended application different distributions might arise). By restricting

the input to a class ∆?of distributions, they are able to show more realistic

ratios for the performance of well known paging algorithms. The Max/Max

ratio, introduced by Borodin and Ben-David [3] compares online algorithms

based on their amortized worst-case behaviour (here the amortization arises

by dividing the cost of the algorithm over the length of the request sequence).

This measure is based on directed comparison of online algorithms and re-

flects the influence of lookahead. However, it does not provide better sepa-

ration results than competitive analysis of paging algorithms. The relative

worst order ratio [7, 16, 20] combines some of the desirable properties of

the Max/Max ratio and the random order ratio (this last introduced in [21]

in the context of the online bin packing problem). As with the Max/Max

ratio, it allows for direct comparison of two online algorithms. Informally,

this measure compares the performance of two algorithms on a given re-

quest sequence by considering the worst-case ordering (permutation) of the

sequence, for each algorithm. It then selects among all possible sequences

3

Page 4

the one that maximizes this worst-case performance. This measure reflects

the influence of lookahead for paging and separates the performance of LRU

from FWF [16]. More recently, Panagiotou and Souza proposed a model that

explains the efficiency of LRU in practice [8]. In their work, they classified

request sequences according to some parameters and proved an upper bound

on the competitive ratio of LRU as a function of these parameters. Then they

argued that, in practice, typical request sequences have parameters that lead

to a constant competitive ratio for LRU.

It is well known that “real-life” sequences for paging usually exhibit a high

degree of locality of reference [11]. This means that the currently requested

page is likely to be requested again in the near future. Several theoretical

models and techniques have been proposed in order to capture and exploit

locality of reference. Borodin, Raghavan, Irani, and Schieber [22] proposed

the access graph model in which the universe of possible request sequences

is reduced to reflect the fact that actual sequences depend heavily on the

structure of the program being executed. The space of request sequences

can then be modeled by a graph in which paths between vertices correspond

to request sequences. Chrobak and Noga showed that the competitive ratio

of LRU is at least as good as FIFO on every access graph [23]. In a gen-

eralization of the access graph model, Karlin, Phillips, and Raghavan [24]

proposed a model in which the space of request sequences has a distribution

induced by a Markov chain process. In other work, Becchetti [14] refined the

diffuse adversary model of Koutsoupias and Papadimitriou described earlier

by considering only probabilistic distributions in which locality of reference is

present. Using this model he proves that the performance of LRU improves as

locality increases while the reverse is true for FWF. Torng [12] considered the

decomposition of request sequences to phases in the same manner as marking

algorithms. He then modeled locality of reference by restricting the input to

sequences with long average phase length. Using the full access cost model,

he computed the performance of several paging algorithms on sequences with

high locality of reference. He showed that this model reflects the influence of

lookahead and also gives constant performance ratios for LRU on sequences

with significant locality of reference. However, all conservative and marking

algorithms have the same performance in this model.

Albers, Favrholdt, and Giel [13] introduced a model in which request

sequences are classified according to a measure of locality of reference. The

measure is based on Denning’s working set concept [25] which is supported

by extensive experimental results. The technique used reflects the fact that

4

Page 5

efficient algorithms must perform competitively in each class of inputs of

similar locality of reference, as opposed to the worst case alone. Using this

model, they showed that LRU has better performance than FWF and FIFO.

These measures achieve different degrees of partial separation between

well known algorithms for paging. Recently, Angelopoulos et al. introduced

bijective Analysis and average Analysis [26] which combined with the locality

model of Albers et al. [13], shows that LRU is the sole optimal paging algo-

rithm on sequences with locality of reference. They also applied these models

to list update algorithms [27]. This resolved an important disparity between

theory and practice of online paging algorithms, namely the superiority in

practice of LRU.

A remaining question however, is how to characterize the full spectrum of

performance of the various known paging algorithms. As discussed above, the

competitive ratio focuses on the worst case which in this setting is known

to be the same for all algorithms. In this paper we compare instead the

performance of two algorithms across the entire range of inputs; in that

comparison we use the fault rate measure instead of the competitive ratio.

Aside from artifacts introduced by the comparison to an offline algorithm,

practitioners find the fault rate a better indicator of performance. Formally,

the fault rate of a paging algorithm A on a sequence σ of length n is the

number of faults that A incurs on A divided by n. The fault rate of A on

a set of sequences is the worst (maximum) fault rate of A on any of those

sequences. The idea behind the fault rate is that sequences on which A incurs

very few faults compared to the number of requests are not that important,

even if the number of faults happens to be much higher than what can be

achieved by an offline (or even online) optimum. We show this using an

example. Let A and B two online paging algorithms so that A incurs less

faults than B on most sequences. Suppose that the fault rate of A is generally

much lower than that of B, so clearly A is preferable to B. However, if there

happens to be an “easy” sequence σ of length 1000000 on which A incurs 100

faults, B incurs 10 faults and optimal offline algorithm can serve σ by only

2 faults, then the competitive ratio of A is 50 while that of B is 5 suggesting

the opposite of the logical conclusion. Note that the fault rate of A and B on

σ is 0.01 and 0.001, respectively, which is miniscule and thus of no relevance

to the actual performance of a system using either algorithm.

Our results. In this paper we aim to provide a tool for finer study and sepa-

ration of the relative performance characteristics of online paging algorithms.

5