/
Minimizing Cache Usage in Paging Minimizing Cache Usage in Paging

Minimizing Cache Usage in Paging - PowerPoint Presentation

olivia-moreira
olivia-moreira . @olivia-moreira
Follow
390 views
Uploaded On 2017-05-26

Minimizing Cache Usage in Paging - PPT Presentation

Alejandro López Ortiz Alejandro Salinger University of Waterloo Outline Paging Paging with cache usage Interval Scheduling Online algorithms Simulations Conclusions 2 Paging 3 ID: 552436

cost cache paging competitive cache cost competitive paging ratio faults interval bound fault online page usage algorithms algorithm schedule

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Minimizing Cache Usage in Paging" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Minimizing Cache Usage in Paging

Alejandro

López

-Ortiz ,

Alejandro Salinger

University

of WaterlooSlide2

Outline

Paging

Paging

with cache usageInterval SchedulingOnline algorithmsSimulationsConclusions

2Slide3

Paging

3

Slow memory

Cache of

size

k

…p

6

p

3

p

2 p4 p4 p2 p10 p11 p5 p4…

Page requests

Is pi in the cache?

-Yes

Goal: minimize number of faults

Traditional cost model Hit: 0 Fault: 1

Hit

-No

Fault

Fetch p

i

from slow memory,

evict one page from cacheSlide4

Paging

Common eviction policies:

Least Recently Used

(LRU)

First In First Out

(FIFO)

Flush When Full (FWF)

Furthest In The Future (FITF) (offline)

Marking and conservative algorithms are k-competitive4Slide5

Paging with Cache Usage

5Slide6

Paging with Cache Usage

Input: sequence

, cache size k

Cost: faults + amount of cache usedk(i

): number of pages in cache at request

i

Cache usage:

Total cost

Goal: minimize total cost 

f

ault costcell cost6Slide7

Applications

Shared cache multiprocessors

7Slide8

Applications

Shared cache multiprocessors

Cooperative caching

8Slide9

Applications

Energy efficient caching

Content Addressable Memories (CAMs)

1

14

5

3

8

713

9

111015

24418

2130172219

2Cache39Slide10

Applications

Energy efficient caching

Content Addressable Memories (CAMs)

Power of search proportional to valid cells

1

5

3

8

7

9

10

15244

3022

2Cache310Slide11

Related Cost Models

Full Access Cost [

Torng

98]Hit: 1Fault:

Coincides with classic model when

Marking algorithms, competitive ratio =

Captures

locality of reference

 11Slide12

Related Cost Models

Buying Cache Model [

Csirik

et al. 01]Algorithm may purchase cache at cost c(x)Cost = faults + purchased cacheNo limit on purchased cacheNo returns

12Slide13

Paging as Interval Scheduling

13Slide14

Interval Scheduling

1

2

3

4

1

1

35234512

1

2

3

4113523

4512

: feasible schedule of on k-1 machines can be served with cache size k faults =

cache usage =

 14 Slide15

Offline Optimum

Reduce

to

Weighted Interval SchedulingOptimal does not schedule an interval with

Remove all such intervals

,

Max weight schedule = minimum total cost

time (with [

Arkin and Silverberg 87]) 15

1

234113523451

2Slide16

Online Algorithms

16Slide17

Online Algorithms

Marking or conservative algorithms are still k-competitive

But they use all available cache

Family of cost sensitive algorithmsLet

be any paging algorithm

:

Keep each page for at most d requests

If necessary, evict page according to A’s eviction policy 17Slide18

Online Algorithms

A is marking or conservative

What is a good choice for d?

Set d =

?

 

p

p

 

OPT

 p p

 OPT  

Not quite…18Slide19

Competitive Ratio

of

 

For any conservative or marking A

 

k = 10

19

 Slide20

20

Case

 

Competitive Ratio of

(upper bound)

 

Slide21

Competitive Ratio of

(upper bound)

 

21

Case

 

 

 

 

 

 Slide22

Locality of Reference

L = Average length of phase in k-phase partition

 

k = 10

L = 150

22Slide23

Simulations

23Slide24

Cost Ratio k=5

24Slide25

Cost Ratio k=7

25Slide26

Faults

26Slide27

Average Cache Usage

27Slide28

Conclusions

Introduced Minimum Cache Usage problem

Cost-sensitive family of online algorithms

2 ≤ CR(α) ≤ k2-competitive for sequences with high localityPolynomial time optimal offline algorithm

Algorithms

are

competitive

in practiceFuture Work:Deeper lower bound analysisOther online algorithmsApplications, e.g., shared cache cooperative strategy Thank you28Slide29

Let A be marking or conservative

 

Competitive Ratio of

(lower bound)

 

k = 10

29Slide30

Paging

3

1

14

5

3

8

7

13

9

11

1015244

1821301722

1923Cache

Memory

Hit!

Memory

30Slide31

Paging

6

1

14

5

3

8

7

13

9

11

1015244

1821301722

192Fault!Cache

Memory

6

6

31Slide32

Paging

Input:

sequence of page requests cache size kPaging algorithm = eviction policy

What page should be evicted from the cache?

Traditional cost model

Hit: 0

Fault: 1Goal: minimize the number of faults32Slide33

Competitive Analysis

An online algorithm

A

is r-competitive if for all requests

Competitive

ratio

For any deterministic online algorithm

 

33Slide34

Paging Models

Page has fault cost and size

Page fault (classic) model

Uniform size and fault costsWeighted caching [Chrobak 91]Varying fault costs, uniform page sizesFault model [Irani

97]

Varying sizes, uniform fault cost

Bit model [

Irani 97]Fault cost equals sizeGeneral [Young 98]k-competitive algorithms for all aboveOffline problem is NP-hard34Slide35

Paging Models

Buying Cache Model [

Csirik

et al. 01]Algorithm may purchase cache at cost c(x)Cost = faults + purchased cacheApproximation to upgrading memory systemsCost functions

CR(A)≈3.14619

CR(A)≈d/

ln

d+o(d/ln d)Finite competitive ratio

cost is polynomially bounded 35Slide36

…,3,3,4,5,21,3,4,17,5,3,5,5,6,7,8, ???

Offline Optimum

But paging is an online problem!

Offline algorithm can lead to good online algorithmsClassic paging optimum: FITF

LRU

…,3,3,4,5,21,3,4,17,5,3,5,5,6,7,8,9,6,7,4,4,5,3,15,13,3,3,7,8,9,…

8,7,6,5,5,3,5,17,4

36Slide37

Interval Scheduling

1

2

3

4

1

1

35234512

1

2

3

411352

34512

Weighted Interval scheduling: : set of jobs (start time, duration, weight)m machinesGoal: process of maximum weightPolytime solution via reduction to minimum-cost flow

 37Slide38

Interval Scheduling

: interval representation of

(without unfinished intervals)

is feasible schedule of

on k-1

machines

can be served with cache size k, with

faults and cache usage  

1

2341135234512

38Slide39

Interval Scheduling

Minimize faults

Maximal

I

nterval Scheduling

Greedy by earliest finish time (= FITF’)

Maximizes number of intervals

Cache usage is not optimalWeight assignment: ,

Max weight schedule = minimum faults with minimum cache 12341

13

5234512

39Slide40

Offline Optimum

Recall, we want to minimize

Note: optimal does not schedule an interval with

Opt(

σ

,k):

Compute interval representation

Remove unfinished intervals and intervals with

Assign weightsOptimal cost =

time (with [

Arkin and Silverberg 87]) 40Slide41

Offline Optimum

Reduce to

Weighted Interval Scheduling

,

Max weight schedule = minimum faults with minimum

cache

We

want to minimize

Optimal does not schedule an interval with Remove all such intervalsMax weight schedule = minimum total cost

time (with [

Arkin and Silverberg 87]) 41

12341135234512Slide42

Online Algorithms

Marking algorithm: at most k faults in each phase

LRU, FWF, CLOCK

Conservative algorithm: at most k faults

LRU,

FIFO,

CLOCK

≤ k distinct pages

≤ k distinct pages

≤ k

≤ k≤ k≤ k≤ k

42Slide43

Competitive Ratio of

(upper bound)

 

(2)

 

OPT

OPT

 

43Slide44

Competitive Ratio of

(upper bound)

 

44Slide45

Competitive Ratio of

(upper

bound)

 

45

Case

 Slide46

Competitive Ratio of

(upper bound)

 

 

46Slide47

Competitive Ratio of

(upper bound)

 

 

47Slide48

Faults k=7

48Slide49

Average Cache Usage k=7

49Slide50

(1)

Request page not in cache among

Cache

is never

full → no early evictions

pays

per request

OPT doesn’t keep any pages, pays  …

1

234561234

 Competitive Ratio of (lower bound) 

 

50Slide51

Competitive Ratio of

(lower bound)

 

(2)

Request page not in cache among

… …

In phase:

: k faults, at least cacheOPT keeps k pages and faults once: 1 fault, cache

 

4

31675892

06231

k =

951