Competitive Paging Algorithms Amos Fiat Richard Karp Michael

  • Slides: 30
Download presentation
Competitive Paging Algorithms Amos Fiat, Richard Karp, Michael Luby, Lyle Mc. Geoch, Daniel Sleator,

Competitive Paging Algorithms Amos Fiat, Richard Karp, Michael Luby, Lyle Mc. Geoch, Daniel Sleator, Neal Young presented by Seth Phillips

Overview Introduction n Server Problems n Marking Algorithm n EATR n Lower Bound n

Overview Introduction n Server Problems n Marking Algorithm n EATR n Lower Bound n Competitive Against Other Algorithms n

Introduction – Paging Problem System with k pages of fast memory (cache/RAM) n Has

Introduction – Paging Problem System with k pages of fast memory (cache/RAM) n Has n-k pages of slow memory (RAM/virtual) n Requesting a page not in fast memory n Eject a page to make room (page fault) n

Online paging algorithm Decision made without knowledge of future requests n Performance analyzed against

Online paging algorithm Decision made without knowledge of future requests n Performance analyzed against off-line algorithm – complete knowledge n Deterministic algorithms are k-competitive n

Randomized Algorithms Analyzed as a sum cost of the algorithm n Cost on a

Randomized Algorithms Analyzed as a sum cost of the algorithm n Cost on a sequence of input averaged over all the random choices that the algorithm makes while processing the sequence n

Overview Introduction n Server Problems n Marking Algorithm n EATR n Lower Bound n

Overview Introduction n Server Problems n Marking Algorithm n EATR n Lower Bound n Competitive Against Other Algorithms n

K-server Problem Let G be an n-vertex graph with positive edge lengths obeying the

K-server Problem Let G be an n-vertex graph with positive edge lengths obeying the triangle inequality n Let k mobile servers occupy vertices of G n Given a sequence of requests, each of which specifies a vertex, decide how to move the servers in response to each request n

K-server continued Requests must be satisfied in order of their occurrence in the sequence

K-server continued Requests must be satisfied in order of their occurrence in the sequence n Cost of handling a sequence is equal to the total distance moved by the servers n It is conjectured that there exists a kcompetitive k-server algorithm for any graph n

Uniform k-server problem Cost of moving a server from any vertex to any other

Uniform k-server problem Cost of moving a server from any vertex to any other vertex is 1 n Isomorphic to the paging problem: any vertex with a server is in fast memory and the vertices of the graph represent the address space n

Overview Introduction n Server Problems n Marking Algorithm n EATR n Lower Bound n

Overview Introduction n Server Problems n Marking Algorithm n EATR n Lower Bound n Competitive Against Other Algorithms n

Marking Algorithm Randomized algorithm for uniform k-server problem on graph with n vertices n

Marking Algorithm Randomized algorithm for uniform k-server problem on graph with n vertices n Servers are initially on vertices 1 through k n Algorithm maintains a set of marked vertices n Initially these are the vertices covered by the servers n

Marking Each time a vertex is requested, it is marked n If k+1 vertices

Marking Each time a vertex is requested, it is marked n If k+1 vertices are marked, all marks except the most recently requested vertex are erased n

Serving If vertex is covered, then no servers move n If vertex is not

Serving If vertex is covered, then no servers move n If vertex is not covered, then a server is chosen uniformly at random from the unmarked vertices n That server is moved to cover n

Competitiveness 2*H_k competitive (H_k on the order of ln(k)) n Algorithm implicitly divides request

Competitiveness 2*H_k competitive (H_k on the order of ln(k)) n Algorithm implicitly divides request sequence into phases. n First phase begins with r(i), where I is the smallest integer such that r(i) is not in the set {1 through k}. n

Comp. continued In general the phase starting with r(i) ends with r(j) n j

Comp. continued In general the phase starting with r(i) ends with r(j) n j is the smallest integer such that the set {r(i), r(i+1), . . . , r(j+1)} has cardinality k+1 n

Comp. continued Implicitly the first request of every phase is made to an unmarked

Comp. continued Implicitly the first request of every phase is made to an unmarked vertex n A vertex is clean if it was not requested in the previous phase and has not yet been requested in this phase – we’ll say there are l of these n A vertex is stale if it was requested in the previous phase and has not yet been requested in this phase n

Adversary Amortized Cost At least l/2 because: n Let d be the number of

Adversary Amortized Cost At least l/2 because: n Let d be the number of servers that do not coincide with marking’s at the beginning of the phase n Let d’ be this quantity at the end of the phase n Cost(A) >= l – d because l requests have to be met, mitigated by a possible d different server locations n

Adversary Cost Continued C(Adv) >= d’ because: n The vertices of S are those

Adversary Cost Continued C(Adv) >= d’ because: n The vertices of S are those covered by Marking at the end of the phase, so d’ servers are not in S n Since Adversary is lazy (does not unnecessarily move servers) at least d’ of A’s servers were outside of S for the entire phase n

Adversary Cost Continued C(Adv) >= max(l – d, d’) >= ½(l – d +

Adversary Cost Continued C(Adv) >= max(l – d, d’) >= ½(l – d + d’) n D and d’ naturally telescope so simply C(Adv) >= l/2 n

Marking Expected Cost l requests to clean vertices – each costs 1 n k

Marking Expected Cost l requests to clean vertices – each costs 1 n k – l requests to stale vertices – each based on the probability that there is no server there n Highest cost is when the l requests to clean vertices come first (allows the most stale vertices to be reassigned) n That leaves the cost of the k-l stales to be: n l/k + l/(k-1) + l/(k-2) +. . . + l/(l+1) = l*(H_k – H_l) n

Final Cost Competitiveness l*H_k – l*H_l + l <= l*H_k n Since the cost

Final Cost Competitiveness l*H_k – l*H_l + l <= l*H_k n Since the cost of the adversary is l/2: n The Marking algorithm is 2*H_k competitive n For the n-1 server problem it is H_n-1 competitive, but for time constraints I’ll skip this n

Overview Introduction n Server Problems n Marking Algorithm n EATR n Lower Bound n

Overview Introduction n Server Problems n Marking Algorithm n EATR n Lower Bound n Competitive Against Other Algorithms n

EATR Stands for End After Twice Requested n This is an algorithm specific to

EATR Stands for End After Twice Requested n This is an algorithm specific to the uniform 2 server problem n Servers initially on vertices 1 + 2 n Stale redefined to not clean and not the most recently requested vertex n When a stale vertex is requested, the servers are placed on the two most recently requested vertices n

EATR Analysis Let l be the number of clean vertices requested during a phase

EATR Analysis Let l be the number of clean vertices requested during a phase n The number of stale vertices before the request that terminates the phase is l+1 n The probably of a server on each of these is 1/(l+1) n The expected cost of each phase is l + l/(l+1) n

Adversary Analysis The best possible cost incurred by any algorith for each phase is

Adversary Analysis The best possible cost incurred by any algorith for each phase is at least l n The competitive factor is therefore: (l + l/(l+1))/l = 1 + 1/(l+1) <= 3/2 n

Overview Introduction n Server Problems n Marking Algorithm n EATR n Lower Bound n

Overview Introduction n Server Problems n Marking Algorithm n EATR n Lower Bound n Competitive Against Other Algorithms n

Lower Bound There is no c-competitive randomized algorithm for the uniform (n-1) server problem

Lower Bound There is no c-competitive randomized algorithm for the uniform (n-1) server problem on n vertices with c < H_n-1 n (Time constraints) The article proves this, which also makes the marking algorithm in a class of best possible algorithms for this problem n

Overview Introduction n Server Problems n Marking Algorithm n EATR n Lower Bound n

Overview Introduction n Server Problems n Marking Algorithm n EATR n Lower Bound n Competitive Against Other Algorithms n

Algorithms Competitive Against Several Others Adopt a viewpoint where each algorithm is tailored for

Algorithms Competitive Against Several Others Adopt a viewpoint where each algorithm is tailored for a specific choice of k and n. n The ordered pair (k, n) is called the type of algorithm n Let A be adeterministic and B be a deterministic on-line algorithms of the same type and c be a positive constant n If for every sequence r of requests C_A(r) <= c*C_B(r) + alpha then A is c-competitive with B n

ACASO continued Let c* = (c(1), c(2), . . . C(m)) be a sequence

ACASO continued Let c* = (c(1), c(2), . . . C(m)) be a sequence of postive real numbers n c* is realizable if, for every (k, n) and every sequence B(1), B(2). . . B(m) there exists an algorithm A of type (k, n) such then A is c(i) competitive with B(i) n c* realizable iff: Sum from 1 to m of (1/c(i)) <= 1 n