Απευθείας Υπολογισµός (Online Computation)

Size: px
Start display at page:

Download "Απευθείας Υπολογισµός (Online Computation)"

Transcription

1 ΕΘΝΙΚΟ ΜΕΤΣΟΒΙΟ ΠΟΛΥΤΕΧΝΕΙΟ Σχολή Ηλεκτρολόγων Μηχανικών & Μηχανικών Υπολογιστών Απευθείας Υπολογισµός (Online Computation) Κ. Πατρούµπας 24 Μαΐου /05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 1

2 Online Algorithms: Why? Offline algorithms: Typical algorithms receive their entire inputs at one time. Unrealistic assumption in many practical situations. Online algorithms: Receive and process their input in partial amounts (incrementally). Receive a sequence of requests and service each one before receiving the next one. Generate output without knowledge of the entire input. For each request, make a choice of several alternative strategies. Each alternative has an associated cost. The alternative chosen at a step may influence the cost of future requests. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 2

3 Online Algorithms: Where? In many modern Resource management in operating systems Paging in a two-level memory: keep actively referenced pages in fast memory without knowing which pages will be requested in the Data structures Dynamically maintain a tree or a linked list so that a sequence of future requests will be served at low Scheduling & load balancing Schedule a series of jobs on a set of machines so as to optimize an objective function without knowledge of future Networks Dynamically maintain a set of active connections between nodes without knowing which connections will be needed in the Distributed computing, Web caching, Robot motion planning, Financial applications, Competitive auctions, 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 3

4 Online Algorithms: How? Quality of online algorithms: Evaluation using competitive analysis. Traditional worst-case analysis is meaningless for online algorithms. Compare the output (and total cost) generated by the online algorithm to that produced by an optimal offline algorithm, which services the same sequence of the requests. Optimal offline algorithm => an omniscient algorithm that knows the entire request sequence in advance and can compute an optimal output, tailoring its responses accordingly. The worst-case ratio over all possible request sequences between the two algorithms measures the quality of the online algorithm. The better the online algorithm approximates the optimal solution, the more competitive it is. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 4

5 Online Algorithms: How? Methods of Analysis: Worst Case Analysis For any input, the cost of the online algorithm is never worse than C times the cost of the optimal offline algorithm. Seen as a game between the online algorithm and an adversary. Adversary tries to devise each new piece of the input which will cause the algorithm to incur a high cost. Algorithm tries to minimize cost. =>A strong worst-case performance measure: a competitive algorithm must perform well on all inputs. (Often pessimistic!) Probabilistic Analysis Assume a distribution generating the input (determined in advance) Find an algorithm that minimizes expected cost of the algorithm. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 5

6 Online Algorithms Outline of the presentation The Online Paging Problem Adversary Models Paging against the Oblivious Adversary Relating the Adversaries The Adaptive Online Adversary The k-server Problem Recent Approaches 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 6

7 The Online Paging Problem Computer memory organized as a two-level store: a cache (fast memory) for k memory items (pages of virtual memory) a slower main memory that can hold infinite number of items (pages). Paging algorithm: Which k items to retain in cache at any point in time. A sequence of requests, specifying a memory item. Hit: the requested item is currently in cache. No cost at all. Miss: the item must be fetched from main memory at a unit cost => one of the k items currently in cache must be evicted, to free storage for the new item. Cost measure: the number of misses on a sequence of requests. Cost depends on the decision made at any point in time. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 7

8 The Online Paging Problem Eviction rule: Try not to evict items that will be requested again in the near future. Online paging algorithm: Make the decision without knowledge of future requests. Offline paging algorithm: Make the decision with complete knowledge about future requests. Typical deterministic online algorithms: Least Recently Used (LRU) First-in, First-out (FIFO) Least Frequently Used (LFU) Non-trivial computational cost: e.g., LRU must maintain a priority queue of timestamps for k items 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 8

9 The Online Paging Problem Request sequence: ρ = ρ 1, ρ 2,..., ρ Ν If the online algorithm A is deterministic, we know its responses. So, it may be computed: the number of times f A (ρ 1, ρ 2,..., ρ Ν ) it misses on this sequence. the minimum possible number of misses f O (ρ 1, ρ 2,..., ρ Ν ) on the same sequence (for an optimal offline algorithm). A deterministic online paging algorithm A is called C-competitive if constant b s.t. sequence ρ 1, ρ 2,..., ρ Ν : f A (ρ 1, ρ 2,..., ρ Ν ) C ⅹ f O (ρ 1, ρ 2,..., ρ Ν ) b Constant b is independent of N, but may depend on k. Competitiveness coefficient C A : infimum of C, s.t. A is C-competitive. => Performance measures based on the worst-case ratio between an online and an optimal offline running on the same sequence. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 9

10 The Online Paging Problem MIN: Optimal offline paging algorithm request sequence ρ 1, ρ 2,..., ρ Ν, on a miss, evict the item whose next request occurs furthest in the future. No deterministic online paging algorithm A has competitiveness coefficient C A k => LRU and FIFO are optimal (k-competitive). Paging algorithm: automaton with a finite set S of states. function F specifies the response of the automaton to each request response depends on current state, the k items in cache, and the newly requested item. response provides a new state and a new set of items in cache. constraint: the new items must include the item requested. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 10

11 The Online Paging Problem Theorem 13.1: Let A be a deterministic online paging algorithm. Then C A k. PROOF: Assumption: for request sequence ρ 1, ρ 2,..., ρ Ν, both offline algorithm and A manage separate caches, initially with the same set of k items. Request sequence determined by A: 1 st request is to an item not in either cache => MISS. S: set of k + 1 items (k initial items in offline s cache + new request). Every request is to the unique item not in A s cache. Partition the request sequence into rounds: Round = maximal sequence of requests in which at most k distinct items are requested (each of them any number of times, in any order). 1 st round begins with the 1 st request (MISS). End of round: k items have been requested and ρ is the 1 st request of the next round (the one on which offline fails). Algorithm A misses on at least k requests during the round. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 11

12 The Online Paging Problem PROOF (continued): Offline algorithm misses only ONCE: There is only ONE (ρ) of the k+1 items of S that will NOT be requested until the end of the round. When missing on the first request, ρ is evicted =>NO further misses. A is deterministic, so the offline algorithm may guess the entire request sequence => the initial requests ρ of each round are known. Therefore: At the end of each round: both algorithms have the same items in their caches. Arbitrarily long sequences of requests may be created by repeatedly invoking this construction. Always A will have k times as many misses as the offline algorithm. The bottom line: No assumptions on computational resources of space and time: The lower bound applies to any deterministic online algorithm. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 12

13 Online Algorithms Outline of the presentation The Online Paging Problem Adversary Models Paging against the Oblivious Adversary Relating the Adversaries The Adaptive Online Adversary The k-server Problem Recent Approaches 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 13

14 Adversary models Offline algorithm as adversary: Managing the cache Generating the request sequence. Adversary s role (and goal): increase the cost of the online algorithm, while keeping it down for the reference algorithm. Randomization A randomized online algorithm R and a request sequence ρ 1, ρ 2,..., ρ Ν On a miss, R makes a random choice of which of the k items to evict. The number f R (ρ 1, ρ 2,..., ρ Ν ) of misses is a random variable. Study the behavior of R when the sequence of requests is generated by an adversary. Adversaries (what do they know when generating a request?) Oblivious Adaptive Offline Adaptive Online 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 14

15 Adversary models Oblivious adversary No knowledge of the random choices made by R Maintain the entire sequence in advance Worst-case sequence for R, optimally serviced by adversary with MIN Not influenced by actual execution of R (random choices) Randomized algorithm R is called C-competitive against the oblivious adversary if constant b independent of N s.t. sequence ρ 1, ρ 2,..., ρ Ν : E [ f R (ρ 1, ρ 2,..., ρ Ν ) ] C ⅹ f O (ρ 1, ρ 2,..., ρ Ν ) b obl C R Oblivious competitiveness coefficient : infimum of C, s.t. R is C-competitive What if the adversary is allowed to adapt the request sequence to actual choices made by the randomized algorithm? => Adaptive adversaries Choose ρ i+1 after having observed previous responses ρ 1, ρ 2,..., ρ i No information about future choices of R Adaptive adversary and optimal algorithm working in collusion. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 15

16 Adversary models Adaptive Offline adversary Adversary generates the sequence adaptively Request sequence depends on previous random choices made by R Adversary exhibits optimal strategy (using MIN) Both f O (ρ 1, ρ 2,..., ρ Ν ) and f R (ρ 1, ρ 2,..., ρ Ν ) are random variables. Randomized algorithm R is called C-competitive against the adaptive offline adversary if constant b s.t. sequence ρ 1, ρ 2,..., ρ Ν : E [ f R (ρ 1, ρ 2,..., ρ Ν ) ] C ⅹ E [ f O (ρ 1, ρ 2,..., ρ Ν ) ] b aof C R Adaptive offline competitiveness coefficient : infimum of C, s.t. R is C-competitive. Adaptive Online adversary Adversary generates the sequence adaptively as in the Offline case BUT ALSO, concurrently manage a cache online Chooses ρ i+1 after having observed previous responses ρ 1, ρ 2,..., ρ i of R, but immediately gives its own response to ρ i+1 Again f O (ρ 1, ρ 2,..., ρ Ν ) and f R (ρ 1, ρ 2,..., ρ Ν ) are random variables. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 16

17 Adversary models Randomized algorithm R is called C-competitive against the adaptive online adversary if constant b s.t. sequence ρ 1, ρ 2,..., ρ Ν : C det E [ f R (ρ 1, ρ 2,..., ρ Ν ) ] C ⅹ E [ f O (ρ 1, ρ 2,..., ρ Ν ) ] b Adaptive online competitiveness coefficient : infimum of C, s.t. R is C-competitive Adaptive offline adversary at least as powerful as the adaptive online adversary, and this in turn at least as powerful as the oblivious adversary: obl C R randomized algorithm R, aon C R aof C R Let be the lowest competitiveness coefficient of any deterministic paging algorithm, and define similarly the lowest coefficients for any randomized ones. Then: C obl C aon C aof aon C R 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 17

18 Online Algorithms Outline of the presentation The Online Paging Problem Adversary Models Paging against the Oblivious Adversary Relating the Adversaries The Adaptive Online Adversary The k-server Problem Recent Approaches 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 18

19 Paging against the Oblivious Adversary Oblivious adversary cannot predict responses of randomized algorithm. Request sequence specified in advance and does not change. Oblivious adversary does not know the contents of the cache of the online algorithm. Let P the probability distribution by which each ρ i is chosen (allowed to depend on previous choices ρ 1, ρ 2,..., ρ i-1 ). P For a deterministic online algorithm A, its competitiveness C A under P, is defined as the infimum of C, s.t. : E [ f A (ρ 1, ρ 2,..., ρ Ν ) ] C ⅹ E [ f O (ρ 1, ρ 2,..., ρ Ν ) ] b Yao s Minimax Principle: inf R obl C R = sup P P C A i.e. the competitiveness of the best randomized online algorithm equals the competitiveness of the best possible deterministic algorithm A on inputs generated according to a worst-case distribution of requests. Can the randomized paging algorithm achieve superior performance? 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 19 inf A

20 Paging against the Oblivious Adversary Theorem 13.2: Let R be a randomized online paging algorithm. Then H k, k where H k = 1 j is the k th Harmonic number. Intuition: Establish a lower bound on by giving a probability P distribution P and a lower bound on for any deterministic algorithm A. PROOF: / j = 1 Let a set of k+1 memory items I = { I 1, I 2,..., I k+1 }. A sequence ρ is composed of N k such requests. At any given time, k of them are in cache, one outside the cache. Paging algorithm: on a miss, specify which one to evict from cache. How is the request sequence chosen? first request ρ 1 uniformly from all items in set I. for i >1, choose request ρ i uniformly from k items in set I { ρ i-1 }. Offline algorithm divides sequence ρ into rounds, s.t. it misses on the final request of each round. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 20 C A obl C R

21 Paging against the Oblivious Adversary PROOF (continued): Proceed in rounds: Let a set of k+1 memory items I = { I 1, I 2,..., I k+1 }. 1 st round: starts with the 1 st request, ends when every item in I has been requested at least once. Each successive round ends when the (k +1) th distinct item is requested since the beginning of the round. Offline algorithm: use MIN algorithm during each round for paging: leave out of cache the item requested last (the final request) in a round. Each item requested exactly ONCE, so only ONE miss in each round. What about the online algorithm? every request goes to an item chosen uniformly at random from k items (apart from the one requested) = > Probability the item requested is the one left out of cache is 1 / k. Expected number of misses = H k. => Expected number of times the online algorithm misses = = H k ⅹ number of misses of the offline algorithm on the same sequence. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 21

22 Paging against the Oblivious Adversary MARKER: randomized online paging algorithm Proceed in rounds: A marker bit associated to each of the k cache locations. Reset all k marker bits to 0, at the beginning of each round. Hit: the item requested is in cache => set marker bit of its location to 1. Miss: the item requested is not in cache => evict one of k items. Eviction rule: choose an unmarked cache location uniformly at random, evict the item it contains, and set its marker bit to 1. End of round: when a miss occurs but all bits are marked. Theorem 13.3: The MARKER algorithm is (2H k ) competitive. PROOF: Again, an optimal offline algorithm is assumed for sequence ρ 1, ρ 2,..., ρ Ν. Assumption: Both algorithms start with the same k items in cache, and ρ 1 is not in cache. MARKER divides the sequence into a series of rounds, the first beginning with ρ 1. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 22

23 Paging against the Oblivious Adversary PROOF (continued): Each round starts with ρ i and ends with ρ j s.t. there are (k +1) items in the subsequence ρ i, ρ i+1,..., ρ j, ρ j+1 ( ρ j+1 is the first of the next round). All k locations are marked at the end of the round. First request of a round is to an item not currently in cache. Distinguish items in any round: stale, if the item is unmarked, but was marked in the previous round clean, if item is neither stale nor marked. Notation: l : the number of requests to clean items in a round. S 0 : the set of items in the cache of the offline algorithm. S M : the set of items in the cache of the MARKER algorithm. d I : the value S 0 \ S M at the beginning of the round. d F : the value S 0 \ S M at the end of the round. M 0 : the number of misses of the offline algorithm during the round. At least l d I of the l clean items in a round are not in cache of the offline algorithm at the beginning of the round => M 0 l d I 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 23

24 Paging against the Oblivious Adversary PROOF (continued): At the end of the round, all k marked items in S M are those requested during the round. Since d F items in the offline cache are not in S M, the offline algorithm has incurred at least d F misses during the round. So: l d I + d F M 0 max{ l d I, d F} 2 On summing the lower bound over all rounds, each round is charged at least l / 2 number of misses ( amortized number of misses). Expected number of misses of the MARKER algorithm in each round: Each of the l requests to clean items costs a miss. There are k l requests to stale items. The cost of each one is the probability P that it s not in the cache. P is maximized when the l requests to clean items precede the requests to the k l stale ones. For the i th request to a stale item, P = l / (k i +1), where 1 i k l. On summing over i, the expected cost of the MARKER is bounded by: l+ l(h k H l ) l H k MARKER has a competitiveness ratio at least twice the best possible. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 24

25 Online Algorithms Outline of the presentation The Online Paging Problem Adversary Models Paging against the Oblivious Adversary Relating the Adversaries The Adaptive Online Adversary The k-server Problem Recent Approaches 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 25

26 Relating the Adversaries How do adversary models relate to each other? How powerful adversaries are? How competitive a randomized algorithm can be against adaptive adversaries? A more general setting than paging: request-answer games. A request set R and a finite answer set A. Cost functions f : n n n R A R { }, non-negative integer n. Let f the union of all these functions f n. Let ρ the sequence of requests, and α the sequence of answers. A deterministic online algorithm: i sequence of functions gi : R A, for positive integers i. n, and a sequence ρ=(ρ 1, ρ 2,..., ρ n ), Define A(ρ)=(α 1, α 2,..., α n ) A n where α i = g i (ρ 1, ρ 2,..., ρ i ), for i =1,,n. Cost of algorithm on ρ is c A (ρ)=f n (ρ,a(ρ)). Optimal cost for the same sequence: c(ρ)= min { f n (ρ,α) α A n }. Algorithm is a-competitive if ρ, c A (ρ) a[c(ρ)], a is linear function. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 26

27 Relating the Adversaries A randomized online algorithm R against oblivious adversaries: is a probability distribution over deterministic algorithms A x x represents coin tosses of R : a random string that selects a deterministic algorithm. for a request sequence ρ the answer sequence A(ρ) is random. Cost of algorithm on ρ is c R (ρ) -- a random variable. Algorithm is a-competitive against oblivious adversaries, if ρ, E x [c A x(ρ)] a[c(ρ)], where a is linear function. An adaptive offline adversary Q: sequence of functions q n :A n R {STOP}, n =0,1,,d 0 and q d0 = STOP. For a deterministic algorithm A and an adaptive adversary Q, ρ (A,Q) are the requests and α (A,Q) the answers of their interaction. Optimal Cost of algorithm on ρ is c Q (A) = c(ρ(a,q)). 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 27

28 Relating the Adversaries An adaptive online adversary S = (Q, P): an adaptive offline adversary Q, with a sequence P of functions that define its own responses b to the input request sequence. request sequence independent of P (depends on algorithm A only). sequence of functions p n :A n A, n =0,1,,d 0. For a deterministic algorithm A and an adaptive adversary S, ρ (A,Q) are the requests, α (A,S) the answers and b(a,s) the answer sequence of the adversary produced by their interaction. Cost of S on ρ is c S (A) = f n (ρ(a,s), b(a,s)). A randomized algorithm R: a probability distribution on deterministic algorithms A x Costs become random variables. Algorithm is a-competitive against adaptive offline adversaries, if ρ, E x [c A x(ρ)] E[a[c Q (A)]], where a is linear function. Algorithm is a-competitive against adaptive online adversaries, if ρ, E x [c A x(ρ)] E[a[c S (A)]], where a is linear function. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 28

29 Relating the Adversaries Theorem 13.4: If there is a randomized algorithm that is a-competitive against every adaptive offline adversary, then there exists an a-competitive deterministic algorithm. PROOF: Model the request-answer game as a game between two persons: C gives a request in every step and D answers to this request. A position in the game is a pair (ρ,α). This position is an instant winner for C, if f n (ρ,α) > a[c(ρ)], Position (ρ,α) is winning for C, if according to some rule for selecting requests and a positive integer t, s.t. starting from this position an instant winner will be reached in t steps, regardless of how D plays. Suppositions: there is an a-competitive randomized algorithm R for any adaptive offline adversary. there is no deterministic a-competitive algorithm A. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 29

30 PROOF (continued): Relating the Adversaries => C has a winning strategy against any deterministic player in the game. => Initial position (both ρ and α are empty strings) is winning for C, iff: adaptive offline adversary Q, s.t. deterministic algorithm A, c A (Q) > a [ c Q (A) ] BUT, a randomized algorithm R is a probability distribution over A x. By taking expectations: E x [ c Ax (Q)] > E x [a [ c Q (A x ) ]] => E [ c R (Q)] > E [a [ c Q (R) ]] Contradiction: R is not a-competitive, as supposed => C has not a winning strategy. A position (ρ,α) is winning for C iff request ρ n+1 s.t. answer α n+1 the position (ρρ n+1,αα n+1 ) is again a winning position for C. Since the answer set A is finite, if position (ρ,α) is not winning for C then request ρ n+1 an answer α n+1 resulting in a non-winning position. If D counters with answer α n+1 at each step, it has a winning strategy => a deterministic a-competitive algorithm. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 30

31 Relating the Adversaries Theorem 13.5: If R is a-competitive randomized algorithm against any adaptive online adversary, and there is a b-competitive randomized algorithm against any oblivious adversary, then R is (ab)-competitive against any adaptive offline adversary. Intuition: Fix an adaptive offline adversary Q. View R as a probability distribution over deterministic algorithms A x. Then prove that PROOF: E x [c Ax (Q)] E x [a [b[ c Q (A x ) ]]] H: b-competitive randomized algorithm against any oblivious adversary H: probability distribution on deterministic algorithms H y Then, n and ρ R n, E y [c H y(q)] b [c(ρ)]. Adaptive online adversary uses offline Q to generate request sequence and the deterministic H y to answer requests (independently of A): fixed y, define adaptive online adversary S y =(Q,P y ) s.t. deterministic online A, b(a,s y ) = H y (ρ (A,Q)). 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 31

32 PROOF (continued): Relating the Adversaries Since R is a-competitive against adaptive online adversary S y : fixed y, E x [c Ax (S y )] E x [a[c S y(a x )]] Taking expectation over y, E y [E x [c Ax (S y )]] E y [E x [a[c S y(a x )]]]. The adaptive online borrows the request sequence from the adaptive offline adversary, so y, ρ (A x,s y ) = ρ (A x,q)=ρ x. Hence: E x [c Ax (Q)] = E y [E x [c Ax (S y )]] E y [a [E x [c Sy (ρ x )]]] = a [E x [E y [c Hy (ρ x )]]] a [E x [b [c(ρ x )]]] = E x [a [b[ c Q (A x ) ]]] aon obl From Theorems 13.4 and 13.5, the conclusion is: So, for the paging problem: 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 32 C aon C C det obl C = Ω( k / C H k )

33 Online Algorithms Outline of the presentation The Online Paging Problem Adversary Models Paging against the Oblivious Adversary Relating the Adversaries The Adaptive Online Adversary The k-server Problem Recent Approaches 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 33

34 The Adaptive Online Adversary Weighted Paging: generalization of the paging problem Each item x has an associated positive real weight w(x). Cost w(x) when item x is brought into cache from main memory. Total cost is the sum of the costs for each request. When w(x)=1 => the simple paging problem. LRU and FIFO may perform poorly for the weighted paging problem. No randomized online algorithm for the weighted paging problem can achieve a competitiveness coefficient k against adaptive online adversaries. So, RECIPROCAL algorithm is optimal in its performance. RECIPROCAL: online randomized algorithm for weighted paging. Depends only on the weights of the current contents of the cache. Independent of the past. Let x 1, x 2,..., x k the k items in cache, when a miss occurs. Probabilistic eviction rule: evict x i with probability p i with 1/ w( xi ) pi = k 1/ w( x ) j = 1 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 34 j

35 The Adaptive Online Adversary Theorem 13.6: The RECIPROCAL algorithm is k competitive against any adaptive online adversary. Intuition: Use a typical potential function, which measures the discrepancy between a configuration of the online algorithm and a configuration of the offline algorithm after each request. PROOF: R S i S i : set of items kept in the cache by RECIPROCAL after i th reference. ADV : set of items kept in cache by the adversary after i th reference. The potential function is: and Φ i = Φ i Φ i-1. f i f i R : cost incurred by RECIPROCAL when servicing i th request. ADV : cost incurred by the adversary when servicing i th request. Then: X i = f Φ R i i = kf x S R i ADV i w( x) k Φ x S i R i \ S w( x) ADV i 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 35

36 The Adaptive Online Adversary PROOF (continued): Costs incurred by two actions: The adversary evicts an item. Item is brought to cache immediately before it is referenced. Charge the adversary for the items it evicts, rather than the item it brings into the cache. ADV Then, f = w x ), if x i is evicted on i th reference (0, otherwise). i ( i RECIPROCAL evicts an item on a miss and is charged for the weight of the item brought into cache. i = Effects of these actions to X j 1 j : The adversary brings x into cache and evicts x => f ADV i = w(x ) and Φi kw(x ). The contribution of the adversary s action to E [ X i X i-1,,x 1 ] is never positive. f R i = w(x) RECIPROCAL misses on a reference to item x, so that Just before this action, \ 1. By substituting probabilities, R ADV k S \ S Ε[ Φ] = w( x) + k w( x) 1/ w( y) 1/ w( y) y S R 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 36 y S R

37 The Adaptive adaptive Online Adversary PROOF (continued): The contribution of RECIPROCAL s action to E [ X i X i-1,,x 1 ]is 0. After a sequence of requests, Ε[ X i ] 0. Since, Φ 0 and Φ n are bounded, it follows that this is also bounded: R ADV ( Ε[ f ] kε[ f ]) i i Special case of the RECIPROCAL algorithm for (unweighted) paging: On any miss, evict an item chosen at random from the k items in cache. This RANDOM algorithm is k-competitive against any adaptive online adversary. It is also proven that RANDOM has a competitiveness coefficient of kh k against any adaptive offline adversary and There is a randomized algorithm for paging that is H k -competitive. RANDOM provides an instance where Theorem 13.5 holds. i 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 37

38 Online Algorithms Outline of the presentation The Online Paging Problem Adversary Models Paging against the Oblivious Adversary Relating the Adversaries The Adaptive Online Adversary The k-server Problem Recent Approaches 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 38

39 The k-server Problem Typical setting: a metric space. k mobile servers, each residing at one point of the space at any time. A sequence of requests ρ 1, ρ 2,..., ρ Ν is presented to the online algorithm. Each request is a point in space. In response to ρ i, the algorithm must move a server to ρ i, unless a server is already there. When a server is moved from point u to point v, there is a cost c uv = distance(u,v) in the metric space. M A (ρ 1, ρ 2,..., ρ Ν ) = total cost of the online algorithm A for servicing the sequence of requests. M O (ρ 1, ρ 2,..., ρ Ν ) = total cost of an optimal offline algorithm for the same sequence. Then, A is C-competitive if sequence ρ 1, ρ 2,..., ρ Ν : M A (ρ 1, ρ 2,..., ρ Ν ) C ⅹ M O (ρ 1, ρ 2,..., ρ Ν ) b for a constant b independent of N. Competitiveness coefficient C A : infimum of C, s.t. A is C-competitive. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 39

40 The k-server Problem Paging problem: a special case of the k-server problem. A point in metric space corresponds to an item that may be requested. Distance between any two points is 1. Each of the k mobile servers corresponds to one of k cache locations. Moving a server in response to a request = a MISS in paging. Point of origin for server = the memory item evicted to free space for the new item. k-server problem also used to model: planning the motion of two-headed disks. maintenance of data structures. Conjecture: For every metric space, there is a deterministic online algorithm that is k competitive. BUT [ Theorem 13.1 ], for the special case of paging, there is no deterministic online algorithm with a competitiveness coefficient k. Generalize this result for randomized algorithms against adaptive online adversaries. = > NEXT [ Theorem 13.7 ] 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 40

41 The k-server Problem Theorem 13.7: Let R be a randomized online algorithm that manages k servers in any aon metric space. Then k. Intuition: Exhibit an adaptive request sequence ρ 1, ρ 2,..., ρ Ν so that: R is forced to have cost M R (ρ 1, ρ 2,..., ρ Ν ) and an online algorithm with expected cost at most M R (ρ 1, ρ 2,..., ρ Ν ) / k on the same sequence. PROOF: C R Request sequence: Let H a subset of k +1 points in metric space. k points occupied by R s servers : no two servers on the same point. One point that is not occupied by any server = the next request. Starting position and subsequent moves produce a random sequence ρ 1, ρ 2,..., ρ Ν of requests. Total cost for entire sequence: N N R ( ρ, ρ2,..., ρ N ) = cρ = i+ i c 1ρ ρiρi i= 1 i= by moving a server from ρ i+1 to ρ i so as to service request ρ i. M 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 41

42 The k-server Problem PROOF (continued): Intuition: A family of k online algorithms All together pay a cost of at most M R (ρ 1, ρ 2,..., ρ Ν ) for the sequence. A randomly chosen one of these k online algorithms has an expected cost no more than M R (ρ 1, ρ 2,..., ρ Ν ) / k on the same sequence. OnIine adversary s actions: Let ρ 1, u 1, u 2,..., u k the points in H (sequence starts with request for ρ 1 ). Online algorithm B j places servers at all points in H, expect u j,1 j k. B j processes request ρ i as follows: for i=1, use the server at u j and for i>1, if there is no server at ρ i, then it moves server from ρ i-1 to ρ i. It suffices to prove that: At any time in the sequence, the set of k points occupied by B j servers is not the same as the set of k points occupied by B m servers, j m. Then, exactly one of the algorithms B j moves a server at cost cρi 1 ρi Summing over all i and j, the total cost by all algorithms B j is: N 1 k cρ c ( 1, 2,..., ) 1 u M i ρ + i j ρ = R ρ ρ ρn i= 1 + j = /05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 42

43 The k-server Problem PROOF (continued): Why do servers placed by algorithms B j and B m (j m) occupy different sets of points? Let S j and S m the sets of k points, before request ρ i is processed. If S j S m then the two sets remain different after ρ i is processed by B j and B m < = If ρ i is in both S j and S m, neither set is changed when ρ i is processed. If only one of them, say S j, has no server in ρ i, it adds ρ i and drops ρ i-1. But B m has a server at ρ i-1, so the two sets differ. Exactly one of the algorithms B j moves a server on request ρ i with cost. Therefore: k j = 1 M B j ( ρ 1, ρ2,..., ρn ) = M R( ρ1, ρ2,..., ρn ) M B j ( ρ1, ρ,..., ρ ) M ( ρ, ρ2,..., ρ ) / k So, there j s.t. 2 N R 1 N Theorem 13.7 applies to any metric space => also to weighted paging. => RECIPROCAL is optimal for the weighted paging problem. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 43

44 Online Algorithms Outline of the presentation The Online Paging Problem Adversary Models Paging against the Oblivious Adversary Relating the Adversaries The Adaptive Online Adversary The k-server Problem Recent approaches 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 44

45 Recent Approaches k-server Lazy adversaries: when one of the servers is located on a point not covered by the online algorithm s servers, the lazy adversary requests that point. Main Open issue: Develop randomized algorithms with a competitive ratio of c < k in an arbitrary metric space. Paging Standard competitive analysis ignores locality of reference: When a page is requested, the next request is usually to a page that comes from a very small set of associated pages. Approaches modeling locality of reference as an access graph, as a Markov chain or as a working set. LRU has the best possible competitiveness ratio on tree graphs. The access graph has to be known in advance for randomization. Open issue: Develop online algorithms for general directed access graphs. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 45

46 Recent Approaches Web caching Generalized caching is similar to the paging problem (fast memory = = local cache, slow memory = memory of the remaining network) Documents have varying sizes and incur varying costs for download. Several models (Bit, Fault, Cost, General) and algorithms. Open issue: Develop randomized algorithms for generalized caching. Maintaining TCP connections (Connection caching) Limited number of open connections for a node (each with a cache) Synchronize both parts of each connection. Problem usually modeled as a unidirected graph. Local caches are not independent of each other. LRU and FIFO are 2k-competitive (k the size of the largest cache). Randomized RECIPROCAL (Harmonic) algorithm is k-competitive against adaptive online adversaries. Open issues: Generalize objective functions for taking into account delays in establishing connections. Penalize long delays more heavily. Develop randomized algorithms for the objective functions. 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 46

47 Recent Approaches Data Streams Finding frequency counts and association rules in massive, rapid, noisy streams in one pass over the data. Deterministic algorithms exceed memory resources. Randomization / approximation using hashing for frequency counts (Lossy Counting). Sampling can give sublinear time, but low-frequency values are underrepresented in the sample (underestimated) (Sticky sampling). Refinements to Competitive analysis Diffuse adversary model: Adversaries generate input according to a probability distribution D taken from a class of distributions known to the online algorithm. LRU is proven optimal against diffuse adversaries. Comparative analysis: Compare the performance of online algorithms taken from given classes of algorithms. Use of extra resource analyses, statistical adversaries, max/max ratio 24/05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 47

48 Online Algorithms References [MR95] R. Motwani, and P. Raghavan. Randomized Algorithms. Cambridge University Press, [BY98] A. Borodin, and R. El-Yaniv. Online Computation and Competitive Analysis. Cambridge University Press, [HMS01] D. Hand, H. Mannila, P. Smyth. Principles of Data Mining (Adaptive Computation & Machine Learning). MIT Press, [Alb03] S. Albers. Online Algorithms: A Survey. Mathematical Programming, 97: 3-26, [MM02] G. Manku, and R. Motwani. Approximate frequency counts over Data Streams. In Proceedings of the 28 th International Conference on Very Large Data Bases, Hong Kong, /05/2004 Αλγόριθµοι Εξόρυξης εδοµένων 48

Algorithmen II. Peter Sanders, Christian Schulz, Simon Gog. Übungen: Michael Axtmann. Institut für Theoretische Informatik, Algorithmik II.

Algorithmen II. Peter Sanders, Christian Schulz, Simon Gog. Übungen: Michael Axtmann. Institut für Theoretische Informatik, Algorithmik II. Schulz, Gog, Sanders: Algorithmen II - 31. Januar 2017 Algorithmen II Peter Sanders, Christian Schulz, Simon Gog Übungen: Michael Axtmann Institut für Theoretische Informatik, Algorithmik II Web: http://algo2.iti.kit.edu/algorithmenii_ws16.php

More information

Online Algorithms. - Lecture 4 -

Online Algorithms. - Lecture 4 - Online Algorithms - Lecture 4 - Outline Quick recap.. The Cashing Problem Randomization in Online Algorithms Other views to Online Algorithms The Ski-rental problem The Parking Permit Problem 2 The Caching

More information

Removing Belady s Anomaly from Caches with Prefetch Data

Removing Belady s Anomaly from Caches with Prefetch Data Removing Belady s Anomaly from Caches with Prefetch Data Elizabeth Varki University of New Hampshire varki@cs.unh.edu Abstract Belady s anomaly occurs when a small cache gets more hits than a larger cache,

More information

Lecture 8 Sept 25, 2014

Lecture 8 Sept 25, 2014 CS 224: Advanced Algorithms Fall 2014 Prof. Jelani Nelson Lecture 8 Sept 25, 2014 Scribe: Jean Pouget-Abadie 1 Online Algorithms - Overview In this lecture, we are going to cover Online algorithms which

More information

On the Max Coloring Problem

On the Max Coloring Problem On the Max Coloring Problem Leah Epstein Asaf Levin May 22, 2010 Abstract We consider max coloring on hereditary graph classes. The problem is defined as follows. Given a graph G = (V, E) and positive

More information

Lecture Overview. 2 Online Algorithms. 2.1 Ski rental problem (rent-or-buy) COMPSCI 532: Design and Analysis of Algorithms November 4, 2015

Lecture Overview. 2 Online Algorithms. 2.1 Ski rental problem (rent-or-buy) COMPSCI 532: Design and Analysis of Algorithms November 4, 2015 COMPSCI 532: Design and Analysis of Algorithms November 4, 215 Lecturer: Debmalya Panigrahi Lecture 19 Scribe: Allen Xiao 1 Overview In this lecture, we motivate online algorithms and introduce some of

More information

Applied Algorithm Design Lecture 3

Applied Algorithm Design Lecture 3 Applied Algorithm Design Lecture 3 Pietro Michiardi Eurecom Pietro Michiardi (Eurecom) Applied Algorithm Design Lecture 3 1 / 75 PART I : GREEDY ALGORITHMS Pietro Michiardi (Eurecom) Applied Algorithm

More information

Advanced Algorithms. On-line Algorithms

Advanced Algorithms. On-line Algorithms Advanced Algorithms On-line Algorithms 1 Introduction Online Algorithms are algorithms that need to make decisions without full knowledge of the input. They have full knowledge of the past but no (or partial)

More information

ECE7995 Caching and Prefetching Techniques in Computer Systems. Lecture 8: Buffer Cache in Main Memory (I)

ECE7995 Caching and Prefetching Techniques in Computer Systems. Lecture 8: Buffer Cache in Main Memory (I) ECE7995 Caching and Prefetching Techniques in Computer Systems Lecture 8: Buffer Cache in Main Memory (I) 1 Review: The Memory Hierarchy Take advantage of the principle of locality to present the user

More information

Primality Testing. Public-Key Cryptography needs large prime numbers How can you tell if p is prime? Try dividing p by all smaller integers

Primality Testing. Public-Key Cryptography needs large prime numbers How can you tell if p is prime? Try dividing p by all smaller integers Primality Testing Public-Key Cryptography needs large prime numbers How can you tell if p is prime? Try dividing p by all smaller integers Exponential in p (number of bits to represent p) Improvement:

More information

Report on Cache-Oblivious Priority Queue and Graph Algorithm Applications[1]

Report on Cache-Oblivious Priority Queue and Graph Algorithm Applications[1] Report on Cache-Oblivious Priority Queue and Graph Algorithm Applications[1] Marc André Tanner May 30, 2014 Abstract This report contains two main sections: In section 1 the cache-oblivious computational

More information

Wednesday, November 22, 2017

Wednesday, November 22, 2017 Wednesday, November 22, 2017 Topics for today Storage management (Chapter 9) Main memory (3) Variable-partition multiprogramming (4) Paging (5) Virtual memory Page turning algorithms Summary of 5 memory

More information

Real-time integrated prefetching and caching

Real-time integrated prefetching and caching Real-time integrated prefetching and caching Peter Sanders Johannes Singler Rob van Stee September 26, 2012 Abstract The high latencies for access to background memory like hard disks or flash memory can

More information

Approximation Algorithms

Approximation Algorithms Approximation Algorithms Subhash Suri June 5, 2018 1 Figure of Merit: Performance Ratio Suppose we are working on an optimization problem in which each potential solution has a positive cost, and we want

More information

Virtual Memory. Chapter 8

Virtual Memory. Chapter 8 Virtual Memory 1 Chapter 8 Characteristics of Paging and Segmentation Memory references are dynamically translated into physical addresses at run time E.g., process may be swapped in and out of main memory

More information

Operating System - Virtual Memory

Operating System - Virtual Memory Operating System - Virtual Memory Virtual memory is a technique that allows the execution of processes which are not completely available in memory. The main visible advantage of this scheme is that programs

More information

Comp Online Algorithms

Comp Online Algorithms Comp 7720 - Online Algorithms Notes 4: Bin Packing Shahin Kamalli University of Manitoba - Fall 208 December, 208 Introduction Bin packing is one of the fundamental problems in theory of computer science.

More information

More on weighted servers

More on weighted servers More on weighted servers or FIFO is better than LRU Leah Epstein Csanád Imreh Rob van Stee Abstract We consider a generalized 2-server problem on the uniform space in which servers have different costs

More information

Online file caching with rejection penalties

Online file caching with rejection penalties Online file caching with rejection penalties Leah Epstein Csanád Imreh Asaf Levin Judit Nagy-György Abstract In the file caching problem, the input is a sequence of requests for files out of a slow memory.

More information

Approximation Algorithms

Approximation Algorithms Approximation Algorithms Prof. Tapio Elomaa tapio.elomaa@tut.fi Course Basics A 4 credit unit course Part of Theoretical Computer Science courses at the Laboratory of Mathematics There will be 4 hours

More information

Models of distributed computing: port numbering and local algorithms

Models of distributed computing: port numbering and local algorithms Models of distributed computing: port numbering and local algorithms Jukka Suomela Adaptive Computing Group Helsinki Institute for Information Technology HIIT University of Helsinki FMT seminar, 26 February

More information

Operating Systems. Memory: replacement policies

Operating Systems. Memory: replacement policies Operating Systems Memory: replacement policies Last time caching speeds up data lookups if the data is likely to be re-requested again data structures for O(1)-lookup data source set-associative (hardware)

More information

On the Cell Probe Complexity of Dynamic Membership or

On the Cell Probe Complexity of Dynamic Membership or On the Cell Probe Complexity of Dynamic Membership or Can We Batch Up Updates in External Memory? Ke Yi and Qin Zhang Hong Kong University of Science & Technology SODA 2010 Jan. 17, 2010 1-1 The power

More information

CALIFORNIA STATE UNIVERSITY, NORTHRIDGE

CALIFORNIA STATE UNIVERSITY, NORTHRIDGE CALIFORNIA STATE UNIVERSITY, NORTHRIDGE COMPETITIVE ANALYSIS OF ONLINE DISTRIBUTED PAGING ALGORITHMS A thesis submitted in partial fulfillment of the requirements For the degree of Master of Science in

More information

Lecture 2. 1 Introduction. 2 The Set Cover Problem. COMPSCI 632: Approximation Algorithms August 30, 2017

Lecture 2. 1 Introduction. 2 The Set Cover Problem. COMPSCI 632: Approximation Algorithms August 30, 2017 COMPSCI 632: Approximation Algorithms August 30, 2017 Lecturer: Debmalya Panigrahi Lecture 2 Scribe: Nat Kell 1 Introduction In this lecture, we examine a variety of problems for which we give greedy approximation

More information

Memory Management. Virtual Memory. By : Kaushik Vaghani. Prepared By : Kaushik Vaghani

Memory Management. Virtual Memory. By : Kaushik Vaghani. Prepared By : Kaushik Vaghani Memory Management Virtual Memory By : Kaushik Vaghani Virtual Memory Background Page Fault Dirty Page / Dirty Bit Demand Paging Copy-on-Write Page Replacement Objectives To describe the benefits of a virtual

More information

Online Algorithms with Advice

Online Algorithms with Advice Online Algorithms with Advice Marc Renault Supervisor: Adi Rosén, Algorithms and Complexity LRI August 21, 2010 This report is written in English as the maternal language of Marc Renault is English and

More information

A Combined BIT and TIMESTAMP Algorithm for. the List Update Problem. Susanne Albers, Bernhard von Stengel, Ralph Werchner

A Combined BIT and TIMESTAMP Algorithm for. the List Update Problem. Susanne Albers, Bernhard von Stengel, Ralph Werchner A Combined BIT and TIMESTAMP Algorithm for the List Update Problem Susanne Albers, Bernhard von Stengel, Ralph Werchner International Computer Science Institute, 1947 Center Street, Berkeley, CA 94704,

More information

!! What is virtual memory and when is it useful? !! What is demand paging? !! When should pages in memory be replaced?

!! What is virtual memory and when is it useful? !! What is demand paging? !! When should pages in memory be replaced? Chapter 10: Virtual Memory Questions? CSCI [4 6] 730 Operating Systems Virtual Memory!! What is virtual memory and when is it useful?!! What is demand paging?!! When should pages in memory be replaced?!!

More information

Course Outline. Processes CPU Scheduling Synchronization & Deadlock Memory Management File Systems & I/O Distributed Systems

Course Outline. Processes CPU Scheduling Synchronization & Deadlock Memory Management File Systems & I/O Distributed Systems Course Outline Processes CPU Scheduling Synchronization & Deadlock Memory Management File Systems & I/O Distributed Systems 1 Today: Memory Management Terminology Uniprogramming Multiprogramming Contiguous

More information

Locality of Reference

Locality of Reference Locality of Reference 1 In view of the previous discussion of secondary storage, it makes sense to design programs so that data is read from and written to disk in relatively large chunks but there is

More information

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018 CS 580: Algorithm Design and Analysis Jeremiah Blocki Purdue University Spring 2018 Chapter 11 Approximation Algorithms Slides by Kevin Wayne. Copyright @ 2005 Pearson-Addison Wesley. All rights reserved.

More information

A Guide to Deterministic and Randomized Online Algorithms for the List Access Problem

A Guide to Deterministic and Randomized Online Algorithms for the List Access Problem MT F, BIT, and COMB: A Guide to Deterministic and Randomized Online Algorithms for the List Access Problem Kevin Andrew kandrew@cs.hmc.edu David Gleich dgleich@cs.hmc.edu April 30, 2004 Abstract In this

More information

a process may be swapped in and out of main memory such that it occupies different regions

a process may be swapped in and out of main memory such that it occupies different regions Virtual Memory Characteristics of Paging and Segmentation A process may be broken up into pieces (pages or segments) that do not need to be located contiguously in main memory Memory references are dynamically

More information

CHAPTER 6 Memory. CMPS375 Class Notes (Chap06) Page 1 / 20 Dr. Kuo-pao Yang

CHAPTER 6 Memory. CMPS375 Class Notes (Chap06) Page 1 / 20 Dr. Kuo-pao Yang CHAPTER 6 Memory 6.1 Memory 341 6.2 Types of Memory 341 6.3 The Memory Hierarchy 343 6.3.1 Locality of Reference 346 6.4 Cache Memory 347 6.4.1 Cache Mapping Schemes 349 6.4.2 Replacement Policies 365

More information

Lecture 8 13 March, 2012

Lecture 8 13 March, 2012 6.851: Advanced Data Structures Spring 2012 Prof. Erik Demaine Lecture 8 13 March, 2012 1 From Last Lectures... In the previous lecture, we discussed the External Memory and Cache Oblivious memory models.

More information

CSE 521: Design and Analysis of Algorithms I

CSE 521: Design and Analysis of Algorithms I CSE 521: Design and Analysis of Algorithms I Greedy Algorithms Paul Beame 1 Greedy Algorithms Hard to define exactly but can give general properties Solution is built in small steps Decisions on how to

More information

Online Facility Location

Online Facility Location Online Facility Location Adam Meyerson Abstract We consider the online variant of facility location, in which demand points arrive one at a time and we must maintain a set of facilities to service these

More information

Introduction to Algorithms April 21, 2004 Massachusetts Institute of Technology. Quiz 2 Solutions

Introduction to Algorithms April 21, 2004 Massachusetts Institute of Technology. Quiz 2 Solutions Introduction to Algorithms April 21, 2004 Massachusetts Institute of Technology 6.046J/18.410J Professors Erik Demaine and Shafi Goldwasser Quiz 2 Solutions Quiz 2 Solutions Do not open this quiz booklet

More information

The Probabilistic Method

The Probabilistic Method The Probabilistic Method Po-Shen Loh June 2010 1 Warm-up 1. (Russia 1996/4 In the Duma there are 1600 delegates, who have formed 16000 committees of 80 persons each. Prove that one can find two committees

More information

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses.

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses. 1 Memory Management Address Binding The normal procedures is to select one of the processes in the input queue and to load that process into memory. As the process executed, it accesses instructions and

More information

Approximation Algorithms

Approximation Algorithms Approximation Algorithms Prof. Tapio Elomaa tapio.elomaa@tut.fi Course Basics A new 4 credit unit course Part of Theoretical Computer Science courses at the Department of Mathematics There will be 4 hours

More information

CHAPTER 6 Memory. CMPS375 Class Notes Page 1/ 16 by Kuo-pao Yang

CHAPTER 6 Memory. CMPS375 Class Notes Page 1/ 16 by Kuo-pao Yang CHAPTER 6 Memory 6.1 Memory 233 6.2 Types of Memory 233 6.3 The Memory Hierarchy 235 6.3.1 Locality of Reference 237 6.4 Cache Memory 237 6.4.1 Cache Mapping Schemes 239 6.4.2 Replacement Policies 247

More information

Calculating lower bounds for caching problems

Calculating lower bounds for caching problems Calculating lower bounds for caching problems Leah Epstein Rob van Stee Abstract We present a general method for computing lower bounds for various caching problems. We apply the method to two well known

More information

Nim-Regularity of Graphs

Nim-Regularity of Graphs Nim-Regularity of Graphs Nathan Reading School of Mathematics, University of Minnesota Minneapolis, MN 55455 reading@math.umn.edu Submitted: November 24, 1998; Accepted: January 22, 1999 Abstract. Ehrenborg

More information

Chapter 5 Hashing. Introduction. Hashing. Hashing Functions. hashing performs basic operations, such as insertion,

Chapter 5 Hashing. Introduction. Hashing. Hashing Functions. hashing performs basic operations, such as insertion, Introduction Chapter 5 Hashing hashing performs basic operations, such as insertion, deletion, and finds in average time 2 Hashing a hash table is merely an of some fixed size hashing converts into locations

More information

Chapter 6 Memory 11/3/2015. Chapter 6 Objectives. 6.2 Types of Memory. 6.1 Introduction

Chapter 6 Memory 11/3/2015. Chapter 6 Objectives. 6.2 Types of Memory. 6.1 Introduction Chapter 6 Objectives Chapter 6 Memory Master the concepts of hierarchical memory organization. Understand how each level of memory contributes to system performance, and how the performance is measured.

More information

11. APPROXIMATION ALGORITHMS

11. APPROXIMATION ALGORITHMS Coping with NP-completeness 11. APPROXIMATION ALGORITHMS load balancing center selection pricing method: weighted vertex cover LP rounding: weighted vertex cover generalized load balancing knapsack problem

More information

Figure 1: An example of a hypercube 1: Given that the source and destination addresses are n-bit vectors, consider the following simple choice of rout

Figure 1: An example of a hypercube 1: Given that the source and destination addresses are n-bit vectors, consider the following simple choice of rout Tail Inequalities Wafi AlBalawi and Ashraf Osman Department of Computer Science and Electrical Engineering, West Virginia University, Morgantown, WV fwafi,osman@csee.wvu.edug 1 Routing in a Parallel Computer

More information

Memory. Objectives. Introduction. 6.2 Types of Memory

Memory. Objectives. Introduction. 6.2 Types of Memory Memory Objectives Master the concepts of hierarchical memory organization. Understand how each level of memory contributes to system performance, and how the performance is measured. Master the concepts

More information

3 Fractional Ramsey Numbers

3 Fractional Ramsey Numbers 27 3 Fractional Ramsey Numbers Since the definition of Ramsey numbers makes use of the clique number of graphs, we may define fractional Ramsey numbers simply by substituting fractional clique number into

More information

MEMORY MANAGEMENT/1 CS 409, FALL 2013

MEMORY MANAGEMENT/1 CS 409, FALL 2013 MEMORY MANAGEMENT Requirements: Relocation (to different memory areas) Protection (run time, usually implemented together with relocation) Sharing (and also protection) Logical organization Physical organization

More information

Network monitoring: detecting node failures

Network monitoring: detecting node failures Network monitoring: detecting node failures 1 Monitoring failures in (communication) DS A major activity in DS consists of monitoring whether all the system components work properly To our scopes, we will

More information

Introduction. hashing performs basic operations, such as insertion, better than other ADTs we ve seen so far

Introduction. hashing performs basic operations, such as insertion, better than other ADTs we ve seen so far Chapter 5 Hashing 2 Introduction hashing performs basic operations, such as insertion, deletion, and finds in average time better than other ADTs we ve seen so far 3 Hashing a hash table is merely an hashing

More information

Online paging and caching

Online paging and caching Title: Online paging and caching Name: Neal E. Young 1 Affil./Addr. University of California, Riverside Keywords: paging; caching; least recently used; -server problem; online algorithms; competitive analysis;

More information

Data Stream Processing

Data Stream Processing Data Stream Processing Part II 1 Data Streams (recap) continuous, unbounded sequence of items unpredictable arrival times too large to store locally one pass real time processing required 2 Reservoir Sampling

More information

Operating Systems Virtual Memory. Lecture 11 Michael O Boyle

Operating Systems Virtual Memory. Lecture 11 Michael O Boyle Operating Systems Virtual Memory Lecture 11 Michael O Boyle 1 Paged virtual memory Allows a larger logical address space than physical memory All pages of address space do not need to be in memory the

More information

CACHE-OBLIVIOUS SEARCHING AND SORTING IN MULTISETS

CACHE-OBLIVIOUS SEARCHING AND SORTING IN MULTISETS CACHE-OLIVIOUS SEARCHIG AD SORTIG I MULTISETS by Arash Farzan A thesis presented to the University of Waterloo in fulfilment of the thesis requirement for the degree of Master of Mathematics in Computer

More information

6 Distributed data management I Hashing

6 Distributed data management I Hashing 6 Distributed data management I Hashing There are two major approaches for the management of data in distributed systems: hashing and caching. The hashing approach tries to minimize the use of communication

More information

Lecture#16: VM, thrashing, Replacement, Cache state

Lecture#16: VM, thrashing, Replacement, Cache state Lecture#16: VM, thrashing, Replacement, Cache state Review -- 1 min Multi-level translation tree: multi-level page table, paged paging, paged segmentation, hash table: inverted page table combination:

More information

Randomized Algorithms for Online Matching with Two Sources

Randomized Algorithms for Online Matching with Two Sources Distributed Computing Randomized Algorithms for Online Matching with Two Sources Bachelor Thesis Thai Duong Nguyen nguyetha@student.ethz.ch Distributed Computing Group Computer Engineering and Networks

More information

On the Complexity of the Policy Improvement Algorithm. for Markov Decision Processes

On the Complexity of the Policy Improvement Algorithm. for Markov Decision Processes On the Complexity of the Policy Improvement Algorithm for Markov Decision Processes Mary Melekopoglou Anne Condon Computer Sciences Department University of Wisconsin - Madison 0 West Dayton Street Madison,

More information

11. APPROXIMATION ALGORITHMS

11. APPROXIMATION ALGORITHMS 11. APPROXIMATION ALGORITHMS load balancing center selection pricing method: vertex cover LP rounding: vertex cover generalized load balancing knapsack problem Lecture slides by Kevin Wayne Copyright 2005

More information

Online Algorithms. Lecture 11

Online Algorithms. Lecture 11 Online Algorithms Lecture 11 Today DC on trees DC on arbitrary metrics DC on circle Scheduling K-server on trees Theorem The DC Algorithm is k-competitive for the k server problem on arbitrary tree metrics.

More information

The Encoding Complexity of Network Coding

The Encoding Complexity of Network Coding The Encoding Complexity of Network Coding Michael Langberg Alexander Sprintson Jehoshua Bruck California Institute of Technology Email: mikel,spalex,bruck @caltech.edu Abstract In the multicast network

More information

Chapter 8 & Chapter 9 Main Memory & Virtual Memory

Chapter 8 & Chapter 9 Main Memory & Virtual Memory Chapter 8 & Chapter 9 Main Memory & Virtual Memory 1. Various ways of organizing memory hardware. 2. Memory-management techniques: 1. Paging 2. Segmentation. Introduction Memory consists of a large array

More information

Distributed Algorithms 6.046J, Spring, Nancy Lynch

Distributed Algorithms 6.046J, Spring, Nancy Lynch Distributed Algorithms 6.046J, Spring, 205 Nancy Lynch What are Distributed Algorithms? Algorithms that run on networked processors, or on multiprocessors that share memory. They solve many kinds of problems:

More information

4.1 Paging suffers from and Segmentation suffers from. Ans

4.1 Paging suffers from and Segmentation suffers from. Ans Worked out Examples 4.1 Paging suffers from and Segmentation suffers from. Ans: Internal Fragmentation, External Fragmentation 4.2 Which of the following is/are fastest memory allocation policy? a. First

More information

Lecture 1: An Introduction to Online Algorithms

Lecture 1: An Introduction to Online Algorithms Algoritmos e Incerteza (PUC-Rio INF979, 017.1) Lecture 1: An Introduction to Online Algorithms Mar 1, 017 Lecturer: Marco Molinaro Scribe: Joao Pedro T. Brandao Online algorithms differ from traditional

More information

Online Coloring Known Graphs

Online Coloring Known Graphs Online Coloring Known Graphs Magnús M. Halldórsson Science Institute University of Iceland IS-107 Reykjavik, Iceland mmh@hi.is, www.hi.is/ mmh. Submitted: September 13, 1999; Accepted: February 24, 2000.

More information

Hashing Based Dictionaries in Different Memory Models. Zhewei Wei

Hashing Based Dictionaries in Different Memory Models. Zhewei Wei Hashing Based Dictionaries in Different Memory Models Zhewei Wei Outline Introduction RAM model I/O model Cache-oblivious model Open questions Outline Introduction RAM model I/O model Cache-oblivious model

More information

Online Algorithms. Lecture Notes for CSCI 570 by David Kempe December 1, 2006

Online Algorithms. Lecture Notes for CSCI 570 by David Kempe December 1, 2006 Online Algorithms Lecture Notes for CSCI 570 by David Kempe December 1, 2006 So far in class, we have only considered the traditional framework for algorithm design, as follows: we are given an input I,

More information

Compact Sets. James K. Peterson. September 15, Department of Biological Sciences and Department of Mathematical Sciences Clemson University

Compact Sets. James K. Peterson. September 15, Department of Biological Sciences and Department of Mathematical Sciences Clemson University Compact Sets James K. Peterson Department of Biological Sciences and Department of Mathematical Sciences Clemson University September 15, 2017 Outline 1 Closed Sets 2 Compactness 3 Homework Closed Sets

More information

Paging for Multicore Processors

Paging for Multicore Processors Paging for Multicore Processors University of Waterloo Technical Report CS-2011-12 Alejandro López-Ortiz and Alejandro Salinger David R. Cheriton School of Computer Science, University of Waterloo, 200

More information

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18 601.433/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18 22.1 Introduction We spent the last two lectures proving that for certain problems, we can

More information

CPE300: Digital System Architecture and Design

CPE300: Digital System Architecture and Design CPE300: Digital System Architecture and Design Fall 2011 MW 17:30-18:45 CBC C316 Virtual Memory 11282011 http://www.egr.unlv.edu/~b1morris/cpe300/ 2 Outline Review Cache Virtual Memory Projects 3 Memory

More information

CS 153 Design of Operating Systems Winter 2016

CS 153 Design of Operating Systems Winter 2016 CS 153 Design of Operating Systems Winter 2016 Lecture 18: Page Replacement Terminology in Paging A virtual page corresponds to physical page/frame Segment should not be used anywhere Page out = Page eviction

More information

Approximation Algorithms

Approximation Algorithms Approximation Algorithms Given an NP-hard problem, what should be done? Theory says you're unlikely to find a poly-time algorithm. Must sacrifice one of three desired features. Solve problem to optimality.

More information

Lecture : Topological Space

Lecture : Topological Space Example of Lecture : Dr. Department of Mathematics Lovely Professional University Punjab, India October 18, 2014 Outline Example of 1 2 3 Example of 4 5 6 Example of I Topological spaces and continuous

More information

Chapter 8 Virtual Memory

Chapter 8 Virtual Memory Operating Systems: Internals and Design Principles Chapter 8 Virtual Memory Seventh Edition William Stallings Operating Systems: Internals and Design Principles You re gonna need a bigger boat. Steven

More information

Cache Controller with Enhanced Features using Verilog HDL

Cache Controller with Enhanced Features using Verilog HDL Cache Controller with Enhanced Features using Verilog HDL Prof. V. B. Baru 1, Sweety Pinjani 2 Assistant Professor, Dept. of ECE, Sinhgad College of Engineering, Vadgaon (BK), Pune, India 1 PG Student

More information

Introduction to Randomized Algorithms

Introduction to Randomized Algorithms Introduction to Randomized Algorithms Gopinath Mishra Advanced Computing and Microelectronics Unit Indian Statistical Institute Kolkata 700108, India. Organization 1 Introduction 2 Some basic ideas from

More information

Outline. CS38 Introduction to Algorithms. Approximation Algorithms. Optimization Problems. Set Cover. Set cover 5/29/2014. coping with intractibility

Outline. CS38 Introduction to Algorithms. Approximation Algorithms. Optimization Problems. Set Cover. Set cover 5/29/2014. coping with intractibility Outline CS38 Introduction to Algorithms Lecture 18 May 29, 2014 coping with intractibility approximation algorithms set cover TSP center selection randomness in algorithms May 29, 2014 CS38 Lecture 18

More information

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy Operating Systems Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. AL-AZHAR University Website : eaymanelshenawy.wordpress.com Email : eaymanelshenawy@yahoo.com Reference

More information

Time and Space Lower Bounds for Implementations Using k-cas

Time and Space Lower Bounds for Implementations Using k-cas Time and Space Lower Bounds for Implementations Using k-cas Hagit Attiya Danny Hendler September 12, 2006 Abstract This paper presents lower bounds on the time- and space-complexity of implementations

More information

On the Performance of Greedy Algorithms in Packet Buffering

On the Performance of Greedy Algorithms in Packet Buffering On the Performance of Greedy Algorithms in Packet Buffering Susanne Albers Ý Markus Schmidt Þ Abstract We study a basic buffer management problem that arises in network switches. Consider input ports,

More information

Trees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph.

Trees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph. Trees 1 Introduction Trees are very special kind of (undirected) graphs. Formally speaking, a tree is a connected graph that is acyclic. 1 This definition has some drawbacks: given a graph it is not trivial

More information

Final Exam. Introduction to Artificial Intelligence. CS 188 Spring 2010 INSTRUCTIONS. You have 3 hours.

Final Exam. Introduction to Artificial Intelligence. CS 188 Spring 2010 INSTRUCTIONS. You have 3 hours. CS 188 Spring 2010 Introduction to Artificial Intelligence Final Exam INSTRUCTIONS You have 3 hours. The exam is closed book, closed notes except a two-page crib sheet. Please use non-programmable calculators

More information

Notes for Lecture 24

Notes for Lecture 24 U.C. Berkeley CS170: Intro to CS Theory Handout N24 Professor Luca Trevisan December 4, 2001 Notes for Lecture 24 1 Some NP-complete Numerical Problems 1.1 Subset Sum The Subset Sum problem is defined

More information

Randomized Algorithms Part Four

Randomized Algorithms Part Four Randomized Algorithms Part Four Announcements Problem Set Three due right now. Due Wednesday using a late day. Problem Set Four out, due next Monday, July 29. Play around with randomized algorithms! Approximate

More information

Randomized Algorithms Part Four

Randomized Algorithms Part Four Randomized Algorithms Part Four Announcements Problem Set Three due right now. Due Wednesday using a late day. Problem Set Four out, due next Monday, July 29. Play around with randomized algorithms! Approximate

More information

CS161 Design and Architecture of Computer Systems. Cache $$$$$

CS161 Design and Architecture of Computer Systems. Cache $$$$$ CS161 Design and Architecture of Computer Systems Cache $$$$$ Memory Systems! How can we supply the CPU with enough data to keep it busy?! We will focus on memory issues,! which are frequently bottlenecks

More information

Outline. 1 Paging. 2 Eviction policies. 3 Thrashing 1 / 28

Outline. 1 Paging. 2 Eviction policies. 3 Thrashing 1 / 28 Outline 1 Paging 2 Eviction policies 3 Thrashing 1 / 28 Paging Use disk to simulate larger virtual than physical mem 2 / 28 Working set model # of accesses virtual address Disk much, much slower than memory

More information

Chapter 3. Set Theory. 3.1 What is a Set?

Chapter 3. Set Theory. 3.1 What is a Set? Chapter 3 Set Theory 3.1 What is a Set? A set is a well-defined collection of objects called elements or members of the set. Here, well-defined means accurately and unambiguously stated or described. Any

More information

Chapter 9: Virtual-Memory

Chapter 9: Virtual-Memory Chapter 9: Virtual-Memory Management Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation of Frames Thrashing Other Considerations Silberschatz, Galvin and Gagne 2013

More information

Cache-Oblivious Traversals of an Array s Pairs

Cache-Oblivious Traversals of an Array s Pairs Cache-Oblivious Traversals of an Array s Pairs Tobias Johnson May 7, 2007 Abstract Cache-obliviousness is a concept first introduced by Frigo et al. in [1]. We follow their model and develop a cache-oblivious

More information

Semi-Passive Replication in the Presence of Byzantine Faults

Semi-Passive Replication in the Presence of Byzantine Faults Semi-Passive Replication in the Presence of Byzantine Faults HariGovind V. Ramasamy Adnan Agbaria William H. Sanders University of Illinois at Urbana-Champaign 1308 W. Main Street, Urbana IL 61801, USA

More information

Practice Exercises 449

Practice Exercises 449 Practice Exercises 449 Kernel processes typically require memory to be allocated using pages that are physically contiguous. The buddy system allocates memory to kernel processes in units sized according

More information

On the Smoothness of Paging Algorithms

On the Smoothness of Paging Algorithms On the Smoothness of Paging Algorithms Jan Reineke and Alejandro Salinger Technische Universität Dortmund November 17, 2016 MoHvaHon: Real-Hme Systems Side airbag in car Side airbag in car ReacHon in

More information

Proving Lower bounds using Information Theory

Proving Lower bounds using Information Theory Proving Lower bounds using Information Theory Frédéric Magniez CNRS, Univ Paris Diderot Paris, July 2013 Data streams 2 Massive data sets - Examples: Network monitoring - Genome decoding Web databases

More information