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
![Page 1: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/1.jpg)
Minimizing Cache Usage in PagingAlejandro López-Ortiz , Alejandro SalingerUniversity of Waterloo
![Page 2: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/2.jpg)
Outline
• Paging • Paging with cache usage• Interval Scheduling• Online algorithms• Simulations• Conclusions
2
![Page 3: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/3.jpg)
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
![Page 4: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/4.jpg)
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
![Page 5: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/5.jpg)
Paging with Cache Usage
5
![Page 6: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/6.jpg)
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
![Page 7: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/7.jpg)
Applications• Shared cache multiprocessors
7
![Page 8: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/8.jpg)
Applications• Shared cache multiprocessors• Cooperative caching
8
![Page 9: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/9.jpg)
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
![Page 10: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/10.jpg)
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
![Page 11: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/11.jpg)
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
![Page 12: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/12.jpg)
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
![Page 13: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/13.jpg)
Paging as Interval Scheduling
13
![Page 14: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/14.jpg)
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
𝐼 (𝜎 )
![Page 15: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/15.jpg)
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
![Page 16: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/16.jpg)
Online Algorithms
16
![Page 17: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/17.jpg)
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
![Page 18: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/18.jpg)
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
![Page 19: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/19.jpg)
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
![Page 20: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/20.jpg)
20
Case
Competitive Ratio of (upper bound)
![Page 21: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/21.jpg)
Competitive Ratio of (upper bound)
21
Case
max 2 , ,𝑘𝛼 (𝑘+1 )𝑘+𝛼−1≤min❑
![Page 22: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/22.jpg)
Locality of Reference• L = Average length of phase in k-phase partition
𝐶𝑅 (𝐴𝛼 )≤ {2𝐿>𝑘𝛼 (𝛼−2)
1+𝑘 (𝛼−1 )+1𝛼+𝑘−1+𝐿
k = 10L = 150
22
![Page 23: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/23.jpg)
Simulations
23
![Page 24: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/24.jpg)
Cost Ratio k=5
24
![Page 25: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/25.jpg)
Cost Ratio k=7
25
![Page 26: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/26.jpg)
Faults
26
![Page 27: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/27.jpg)
Average Cache Usage
27
![Page 28: Minimizing Cache Usage in Paging](https://reader035.vdocuments.site/reader035/viewer/2022062218/5681662f550346895dd99484/html5/thumbnails/28.jpg)
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