Download presentation
Presentation is loading. Please wait.
1
Ecole Polytechnique, Nov 7, 2007 1 Online Job Scheduling Marek Chrobak University of California, Riverside
2
Ecole Polytechnique, Nov 7, 2007 2 Outline: 1.Online optimization problems Competitive analysis Example: caching 2. List scheduling for minimum makesnan Graham’s algorithm is 2-competitive 3. List scheduling for related machines 4. Minimizing total completion time Optimal algorithm for the preemptive case 2-competitive algorithm for the non-preemptive case 5. Scheduling of unit jobs for maximum throughput 2-competitive greedy algorithm 1.618-competitive algorithm for the 2-bounded case Randomized 1.58-competitive algorithm 6. Scheduling equal-length jobs for maximum throughput
3
Ecole Polytechnique, Nov 7, 2007 3 Paging: 2-Level memory system with large disk and k pages in RAM Sequence of requests to pages If the requested page is not in RAM (miss), it must be fetched from disk (another page may need to be evicted) Objective: minimize the number of misses CPU RAM disk k
4
Ecole Polytechnique, Nov 7, 2007 4 Paging example: k= 5 Initial RAM state: 4 3 5 6 1 4 3 5 6 1 4 3 2 6 1 4 3 2 6 1 2 Requests: 39 4 3 2 6 9 7 4 3 2 7 9 5 5 3 2 7 9 5 3 2 7 6 6 5 3 1 7 6 1 Questions: Can we reduce the number of misses? Can we reduce it to zero? Yes No
5
Ecole Polytechnique, Nov 7, 2007 5 Main question: What page to evict on a miss? Common replacement strategies: LRU = least recently used FIFO = first-in first-out 4 3 5 6 Requests: LRU Example: …4 5 3 621574 2 3 5 6 2 3 1 6 2 5 1 6 2 5 1 7 4 5 1 7
6
Ecole Polytechnique, Nov 7, 2007 6 Performance measure? onlin e offline Algorithm A is R-competitive if for any sequence S of page requests (# of misses of A on S) ≤ R·(minimum # of misses on S) + b where C is a constant independent of S Competitive ratio of A = smallest such R usually b=0
7
Ecole Polytechnique, Nov 7, 2007 7 How to determine optimum? Belady Algorithm: at each step evict the page whose next request is farthest in the future. 4 3 5 6 …4 5 3 621579 4 2 5 6 4 1 5 6 4 1 5 6 4 1 7 6 4 1 9 6 6 14 4 1 9 6 4 1 9 6 5 37
8
Ecole Polytechnique, Nov 7, 2007 8 How bad is LRU? Try k=2 each request is a miss every second request is a miss 1 231231 2 31 2 1 2 3 2 3 1 2 1 2 3 1 3 1 2 3 2 3 1 LRU: 1 2 1 3 1 3 2 3 2 3 2 1 2 1 3 1 3 1 Optimum: So competitive ratio of LRU is ≥ 2
9
Ecole Polytechnique, Nov 7, 2007 9 How good is LRU? Try k=2 again So competitive ratio of LRU is ≤ 2 Exercise: Show that the competitive ratio of LRU for k pages is ≤ k. Hint: Similar idea. If all faults in a phase different, you are done. Else, consider two equal faults… Requests: … x y … r z r… p r p … s p s … r’ … p’ … s’ misses of LRU optimum must have r in cache phase = request until the 2nd miss Case 1: s r. Then r,p,s are different In this phase: at least 2 different requests other than r, so optimum must miss at least once Case 2: s = r. So on p we evicted r. There must be another request z r,p between r, p for otherwise LRU would not evict r We have p r and s p
10
Ecole Polytechnique, Nov 7, 2007 10 Is it possible to improve ratio k? Theorem: No online paging algorithm has competitive ratio smaller than k. Proof: A = some online algorithm. Adversary strategy: fix a set of pages 1,2,…,k+1. At each step request the page that A does not have in memory. Then: Algorithm A faults at each time step Belady faults at most once in each k consecutive steps (why?) Therefore the competitive ratio of A is at least k k requests Q B = Belady’s pages in memory Then B and Q differ by at most 1 So at most one fault here
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.