Across all computing systems, memory follows a simple trade-off:
The Speed–Size Trade-off
The Core Algorithmic Question
We have room for only k items in fast storage.
When a new item is needed and the cache is full: \textbf{Which item do we evict?}
Good eviction decisions hide the speed difference!
Our Goal Today: Analyze eviction rules (like LRU) mathematically without knowing the future, and prove rigorous bounds against the best possible offline strategy.
Modern computing systems rely on two-tier storage hierarchies:
Formal Model
If an omniscient algorithm knows the entire future sequence \sigma in advance:
Belady’s \text{MIN} Algorithm (1966)
On a page fault when the cache is full: \textbf{Evict the page whose next request occurs furthest in the future.} (If a page is never requested again, its next request is at \infty).
Theorem (Belady 1966)
Belady’s \text{MIN} achieves the minimum possible number of page faults on any input sequence \sigma: \text{cost}(\text{MIN}(\sigma)) = \text{cost}(\text{OPT}(\sigma))
In real operating systems and hardware caches, the future is completely unknown:
The Core Question
How well can any deterministic online heuristic (like LRU) perform compared to the omniscient Belady \text{MIN}? Can we achieve a constant competitive ratio independent of cache size k?
Theorem (Sleator & Tarjan 1985)
Let \mathcal{A} be any deterministic online paging algorithm for a cache of size k. Then the competitive ratio of \mathcal{A} is at least k: \text{Competitive Ratio } c \ge k
Even for a modest cache (k = 1000 pages), an online deterministic algorithm can be forced to fault 1000\times more often than \text{OPT}!
Let us see why through a simple adversarial example with k=3.
Consider a slow memory with just k + 1 = 4 pages: \{p_1, p_2, p_3, p_4\}. Cache capacity k = 3.
What does offline \text{OPT} do on that exact same adversarial sequence \langle p_4, p_1, p_2, p_3, p_4, p_1, \dots \rangle?
\text{Competitive Ratio} = \frac{\text{cost}(\text{ALG})}{\text{cost}(\text{OPT})} \ge \frac{m}{m/k} = \mathbf{k}
The lower bound is k. Can common algorithms like LRU actually guarantee c = k?
The Phase Partitioning Technique
To prove LRU is k-competitive, partition the request sequence \sigma into phases:
Consider any single Phase i under LRU:
How many faults must offline \text{OPT} incur across two consecutive phases?
\text{cost}(\text{LRU}) \le k \cdot P \le k \cdot (\text{OPT} + 1) \implies \mathbf{\text{LRU is } k\text{-competitive!}}
Why did deterministic algorithms hit a hard barrier of k?
The Vision
Can randomization drop the competitive ratio from k \to O(\log k)?
Maintain a 1-bit “mark” (0 or 1) on every cache slot:
Algorithm Rules
Suppose cache has 3 slots, currently holding \{p_1, p_2, p_3\}, all unmarked:
| Algorithm | Type | Competitive Ratio | Practical Status |
|---|---|---|---|
| Deterministic Lower Bound | Theoretical Limit | \ge k | Hard barrier for any det. alg |
| FIFO | Deterministic | k | Simple, sub-optimal in practice |
| LRU | Deterministic | k | Industry gold standard |
| Randomized Marking | Randomized | 2 H_k \approx 2 \ln k | Simple 1-bit randomized mark |
| Equitable / Partition | Randomized (Optimal) | H_k \approx \ln k | Matches randomized lower bound |
Lecture Takeaway
Randomization conceals internal cache choices from the adversary, dropping competitive vulnerability from a linear penalty k to an exponential improvement \Theta(\log k).
CS G526: Advanced Algorithms & ComplexityTulasimohan Molli