450 likes | 582 Views
Minimizing Cache Usage in Paging. Alejandro Salinger University of Waterloo Joint work with Alex L ópez -Ortiz. Outline. Paging problem and models Paging with cache usage O ffline optimum Online algorithms Simulations Conclusions. Paging. Hit!. Cache. 1. 5. 8. 13. 11. 3. 14. 3.
E N D
Minimizing Cache Usage in Paging Alejandro Salinger University of Waterloo Joint work with Alex López-Ortiz
Outline • Paging problem and models • Paging with cache usage • Offline optimum • Online algorithms • Simulations • Conclusions
Paging Hit! Cache 1 5 8 13 11 3 14 3 7 9 10 3 15 4 21 17 19 24 18 30 22 2 Memory Memory
Paging Fault! Cache 1 5 8 13 11 6 14 3 7 9 10 15 4 21 6 17 19 24 18 30 22 2 Memory 6
Paging Input: sequence of page requests cache size k Paging algorithm = eviction policy What page should be evicted from the cache? Traditional cost model Hit: 0 Fault: 1 Goal: minimize the number of faults
Paging Common eviction policies: • Least Recently Used (LRU) • First In First Out (FIFO) • Flush When Full (FWF) • Furthest In The Future (FITF) (offline)
Competitive Analysis • An online algorithm A is r-competitive if for all requests faults(A) • Competitive ratio • For any deterministic online algorithm
Paging Models • Page has fault cost and size • Page fault (classic) model • Uniform size and fault costs • Weighted caching [Chrobak 91] • Varying fault costs, uniform page sizes • Fault model [Irani 97] • Varying sizes, uniform fault cost • Bit model [Irani 97] • Fault cost equals size • General [Young 98] • k-competitive algorithms for all above Offline problem is NP-hard
Paging Models • Full Access Cost [Torng 98] • Hit: 1 • Fault: • Marking algorithms: • Coincides with classic model when • Captures locality of reference
Paging Models • Buying Cache Model [Csirik et al. 01] • Algorithm may purchase cache at cost c(x) • Cost = faults + purchased cache • Approximation to upgrading memory systems • Cost functions • CR(A)≈3.14619 • CR(A)≈d/lnd+o(d/ln d) • Finite competitive ratio cost is polynomially bounded
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 • k(i) ≤ k • Cache usage: • Total cost Goal: minimize total cost fault cost cell cost
Applications • Shared cache multiprocessors
Applications • Shared cache multiprocessors • Cooperative caching
Applications • Energy efficient caching • Content Addressable Memories (CAMs) Cache 1 5 8 13 11 3 14 3 7 9 10 15 4 21 17 19 24 18 30 22 2
Applications • Energy efficient caching • Content Addressable Memories (CAMs) • Power of search proportional to valid cells Cache 1 5 8 3 3 7 9 10 15 4 24 30 22 2
Offline Optimum • But paging is an online problem! • Offline algorithm can lead to good online algorithms • Classic 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,… …,3,3,4,5,21,3,4,17,5,3,5,5,6,7,8, ??? 8,7,6,5,5,3,5,17,4
Interval Scheduling • Interval scheduling: • : set of jobs (start time, duration, weight) • m machines • Goal: process of maximum weight • Polytime solution via reduction to minimum-cost flow
Interval Scheduling : interval representation of (without unfinished intervals) is feasible schedule of on k-1 machines can be served with cache size k, with with faults and cache usage
Interval Scheduling • Minimize faults Maximal Interval Scheduling • Greedy by earliest finish time (= FITF’) • Maximizes number of intervals • Cache usage is not optimal • Weight assignment: • , • Max weight schedule = minimum faults with minimum cache
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 weights • Optimal cost = • time (with [Arkin and Silverberg 87])
Online Algorithms • Marking algorithm: at most k faults in each phase • LRU, FWF, CLOCK • Conservative algorithm: at most k faults • LRU, FIFO, CLOCK ≤ k ≤ k ≤ k ≤ k ≤ k ≤ k distinct pages ≤ k distinct pages
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 • : • At t=i, evict page requested at t=i-d if still in cache and was not requested since • If necessary, evict page according to A’s eviction policy
Online Algorithms • A is marking or conservative • What is a good choice for d? • Set d = • ? p p OPT p p OPT Not quite…
Competitive Ratio of (lower bound) • Let A be marking or conservative k = 10
Competitive Ratio of (lower bound) (1) Request page not in cache among Cache is never full → no early evictions pays per request OPT doesn’t keep any pages, pays
Competitive Ratio of (lower bound) (2) Request page not in cache among … … In phase: : k faults, pays at least cache OPT keeps k pages and faults once: 1 fault, cache • k = 9
Competitive Ratio of (upper bound) • For any conservative or marking A k = 10
Locality of Reference • L = Average length of phase in k-phase partition k = 10 L = 150
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 highly competitive in practice • Future Work: • Deeper lower bound analysis • Other online algorithms • Applications, e.g., shared cache cooperative strategy Thank you