minimizing cache usage in paging
DESCRIPTION
Minimizing Cache Usage in Paging. Alejandro López -Ortiz , Alejandro Salinger University of Waterloo. Outline. Paging Paging with cache usage Interval Scheduling Online algorithms Simulations Conclusions. Paging. Slow memory. Cache of size k . Page requests. - PowerPoint PPT PresentationTRANSCRIPT
Minimizing Cache Usage in PagingAlejandro López-Ortiz , Alejandro SalingerUniversity of Waterloo
Outline
• Paging • Paging with cache usage• Interval Scheduling• Online algorithms• Simulations• Conclusions
2
Paging
3
Slow memory Cache of size k
…p6 p3 p2 p4 p4 p2 p10 p11 p5 p4…Page requests
Is pi in the cache? -Yes
Goal: minimize number of faults
Traditional cost modelHit: 0Fault: 1
Hit-No Fault
Fetch pi from slow memory, evict one page from cache
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-competitive
4
Paging with Cache Usage
5
Paging with Cache Usage• Input: sequence , cache size k• Cost: faults + amount of cache used• k(i): number of pages in cache at request i• Cache usage: • Total cost
Goal: minimize total cost
fault cost cell cost
6
Applications• Shared cache multiprocessors
7
Applications• Shared cache multiprocessors• Cooperative caching
8
Applications• Energy efficient caching• Content Addressable Memories (CAMs)
1
14
5
3
8
7
13
9
11
10
15
24
4
18
21
30
17
22
19
2
Cache
3
9
Applications• Energy efficient caching• Content Addressable Memories (CAMs)• Power of search proportional to valid cells
1 5
3
8
7 9 10
15
24
4
30 22 2
Cache
3
10
Related Cost Models• Full Access Cost [Torng 98]• Hit: 1• Fault:• Coincides with classic model when • Marking algorithms, competitive ratio = • Captures locality of reference
11
Related Cost Models• Buying Cache Model [Csirik et al. 01]• Algorithm may purchase cache at cost c(x)• Cost = faults + purchased cache• No limit on purchased cache• No returns
12
Paging as Interval Scheduling
13
Interval Scheduling
1 2 3 4 1 1 3 5 2 3 4 5 1 21 2 3 4 1 1 3 5 2 3 4 5 1 2
: feasible schedule of on k-1 machines
can be served with cache size k faults = cache usage =
14
𝐼 (𝜎 )
Offline Optimum
• Reduce to Weighted Interval Scheduling
• Optimal does not schedule an interval with • Remove all such intervals
• ,
• Max weight schedule = minimum total cost
• time (with [Arkin and Silverberg 87])
15
1 2 3 4 1 1 3 5 2 3 4 5 1 2
Online Algorithms
16
Online Algorithms• Marking or conservative algorithms are still k-competitive• But they use all available cache
• Family of cost sensitive algorithms
Let be any paging algorithm : • Keep each page for at most d requests• If necessary, evict page according to A’s eviction policy
17
Online Algorithms
• A is marking or conservative• What is a good choice for d?
• Set d =
• ?
p p
OPT
p p
OPT
Not quite…
18
Competitive Ratio of
• For any conservative or marking A
𝐶𝑅 (𝐴𝛼 )≤ { 2− 1𝛼+1
,𝛼<𝑘
¿min(𝑘 , 𝛼 (𝑘+1 )𝑘+𝛼−1 ) ,𝛼≥𝑘
k = 10
19
𝐶𝑅 (𝐴𝛼 )≥ { 2− 1𝛼+1
,𝛼<𝑘−1
¿𝛼 𝑘+𝑘2/2𝛼+𝑘2
,𝛼≥𝑘−1
20
Case
Competitive Ratio of (upper bound)
Competitive Ratio of (upper bound)
21
Case
max 2 , ,𝑘𝛼 (𝑘+1 )𝑘+𝛼−1≤min❑
Locality of Reference• L = Average length of phase in k-phase partition
𝐶𝑅 (𝐴𝛼 )≤ {2𝐿>𝑘𝛼 (𝛼−2)
1+𝑘 (𝛼−1 )+1𝛼+𝑘−1+𝐿
k = 10L = 150
22
Simulations
23
Cost Ratio k=5
24
Cost Ratio k=7
25
Faults
26
Average Cache Usage
27
Conclusions• Introduced Minimum Cache Usage problem• Cost-sensitive family of online algorithms • 2 ≤ CR(α) ≤ k• 2-competitive for sequences with high locality
• Polynomial time optimal offline algorithm• Algorithms are competitive in practice
• Future Work:• Deeper lower bound analysis• Other online algorithms• Applications, e.g., shared cache cooperative strategy
Thank you28