Understanding Performance of Online Paging Algorithms, Slides of Computer Science

The concept of competitive analysis in the context of online algorithms, specifically focusing on the paging problem. The author discusses the importance of online problems in computer science and introduces the concept of competitive ratio. The document then proves that the lru (least recently used) paging algorithm is k-competitive, making it an effective solution for managing cache memory in a two-level memory system.

Typology: Slides

2012/2013

Uploaded on 03/21/2013

dharmaveer
dharmaveer 🇮🇳

4.5

(4)

54 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Competitive Analysis
2
Beyond Worst Case Analysis
Worst-case analysis.
Analyze running time as function of worst input of a given size.
Average case analysis.
Analyze average running time over some distribution of inputs.
Ex: quicksort.
Amortized analysis.
Worst-case bound on sequence of operations.
Ex: splay trees, union-find.
Competitive analysis.
Make quantitative statements about online algorithms.
Ex: paging, load balancing.
3
Online Algorithm and Competitive Analysis
Paging problem: Given two-level store consisting of fast memory
(cache) that can hold k pages, and slow memory that can store
infinitely many pages.
Sequence of page requests p:
if page p already in cache, no cost incurred
otherwise, eject some other page q from cache and replace with
p, and pay unit cost for page fault.
If p not in cache, which page q should you evict?
Most fundamental and practically important online problem in CS.
4
Online Algorithm and Competitive Analysis
Competitive analysis. (Sleator-Tarjan)
Algorithm A is ρ-competitive if there exists some constant b such
that for every sequence of inputs σ:
where OPT is optimal offline algorithm.
OPT = MIN: evict page whose next access is furthest away.
A = LRU: evict page whose most recent access was earliest
!Traditional analysis completely uninformative.
!We show LRU is k-competitive.
A = LIFO: evict page brought in most recently.
!LIFO can have arbitrarily bad competitive ratio.
Fact: no online paging algorithm is better than k-competitive.
.)(cost)(cost b
OPTA +
σ
ρ
σ
Docsity.com
pf2

Partial preview of the text

Download Understanding Performance of Online Paging Algorithms and more Slides Computer Science in PDF only on Docsity!

Competitive Analysis

2

Beyond Worst Case Analysis

Worst-case analysis.^ n

Analyze running time as function of worst input of a given size. Average case analysis.^ n

Analyze average running time over some distribution of inputs. n^

Ex: quicksort. Amortized analysis.^ n

Worst-case bound on sequence of operations. n^

Ex: splay trees, union-find. Competitive analysis.^ n

Make quantitative statements about online algorithms. n^

Ex: paging, load balancing.

3

Online Algorithm and Competitive Analysis

Paging problem: Given two-level store consisting of fast memory(cache) that can hold k pages, and slow memory that can storeinfinitely many pages.^ n

Sequence of page requests p:^ –

if page p already in cache, no cost incurred – otherwise, eject some other page q from cache and replace withp, and pay unit cost for page fault. n^

If p not in cache, which page q should you evict? n^

Most fundamental and practically important online problem in CS.

4

Online Algorithm and Competitive Analysis

Competitive analysis. (Sleator-Tarjan)^ n

Algorithm A is

ρ

-competitive if there exists some constant b such

that for every sequence of inputs

σ

where OPT is optimal offline algorithm. n^

OPT = MIN: evict page whose next access is furthest away. n^

A = LRU: evict page whose most recent access was earliest

Traditional analysis completely uninformative. 3

We show LRU is k-competitive.

n^

A = LIFO: evict page brought in most recently.

LIFO can have arbitrarily bad competitive ratio.

n^

Fact: no online paging algorithm is better than k-competitive.

cost

cost

b

OPT

A^

σ

ρ

σ

Docsity.com

5

Online Algorithm and Competitive Analysis

Theorem. LRU is k-competitive.Proof: Let

τ^

be a subsequence of

σ

on which LRU faults exactly k

times, and

τ does not contain fist access in

σ

. Let p denote page

requested just before

τ

n^

Case 1: LRU faults in sequence

τ^

on p.

-^ τ^ requests at least k+1 different pages

MIN faults at least once n^

Case 2: LRU faults on some page, say q, at least twice in

τ.

-^ τ^ requests at least k+1 different pages

MIN faults at least once

6

Online Algorithm and Competitive Analysis

Theorem. LRU is k-competitive.Proof: Let

τ^

be a subsequence of

σ

on which LRU faults exactly k

times, and

τ does not contain fist access in

σ

. Let p denote page

requested just before

τ

n^

Case 3: LRU does not fault on p, nor on any page more than once.^ –

k different pages are accessed and faulted on, none of which is p – p is in MIN’s cache at start of

τ ⇒

MIN faults at least once

0

1

σ^2

1

σp

MIN faults LRU faults k times

1 times

LRU faults^ ≤

k times

Docsity.com