1 / 4

CSE 5314 On-line Computation Homework 1 Wook Choi Feb/26/2004

CSE 5314 On-line Computation Homework 1 Wook Choi Feb/26/2004. if x is in front of r j. otherwise (including x = r j ). Lemma 1.1 (Pairwise Property lemma)

lotta
Télécharger la présentation

CSE 5314 On-line Computation Homework 1 Wook Choi Feb/26/2004

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSE 5314 On-line Computation Homework 1 Wook ChoiFeb/26/2004

  2. if x is in front of rj otherwise (including x = rj) Lemma 1.1 (Pairwise Property lemma) An algorithm satisfies the pairwise property if and only if for every request σ, when ALG servers σ, the relative order of every two elements x and y in L is the same as their relative order in Lxywhen ALG servers σxy Proof using the partial cost model which does consider only the cost from negative comparisons until a requested item is found in the list: Consider any request sequence σ = r1 , r2, ,… ,rnfor the list L. σxy is defined to be σ after deletion of all the requests for items except for x and y where x, y  L (x ≠ y); Lxyis the projection of the list L over x and y, thus having the same initial order as in L.For each x, and integer 1 ≤ j ≤ n, the penalty cost attributed to x is denoted by ALG (x,j) in accessing jth request, rj where: Let ALG*(σxy)and ALGxy*(σ)be the total cost for processing σxy over Lxy andσover {x,y} L , respectively. Since rj can be either x or y, ALG*(σxy) = ALGxy*(σ) = ALG (x,j) + ALG (y,j). Then, ALG satisfies pairwise property if ALG*(σxy)= ALGxy*(σ). Since the relative order of any two elements x and yL is the same as their relative order in Lxy, ALG(σxy ) and ALGxy*(σ)are the same for all x and y pairs. For example, if rj = x, ALG*(σxy) = ALGxy*(σ) = 0 + 0 andif rj = y, ALG*(σxy) = ALGxy*(σ) = 1 + 0, assuming that x is ahead of y. Therefore, Lemma 1.1 holds. Exercise 1.9 Prove Lemma 1.1

  3. TIMESTAMP Algorithm (each element x maintains 2 timestamps, Recentx and Previousy) When an element x is accessed ifRecentx = 0 then Recentx current time /* first time request */elsePreviousx Recentx , Recentx current time examine each item y preceding x from the front of the list if Previousy < Previousxthen move x before such a first item y. end-ifend-if Exercise 1.12 Prove that TIMESTAMP satisfies the pairwise property Proof using Lemma 1.1 Consider two elements x and y in the list L. Letσxy be a subsequence of σincluding all occurrencesofonly x and y. Let Lxybe a list containing only x and y in the same initial order as in L. If the timestamp algorithm is run on Lxy with σxy and {x, y}  L with σ, the relative order of x and y in L and Lxy depends only on which of Previousx and Previousy is greater. Thus, if and only if x is requested more recently than y, x is moved before y in both lists, L and Lxy which means the relative order of the two elements in Lxyis the same astheir relative order of x and y in the original list L. Therefore, according to Lemma 1.1, the timestamp algorithm satisfies the pairwise property.

  4. Marking algorithm Each page in memory is associated with a bit called its mark. A page is marked when it is first requested and a marking algorithm never evicts a marked page from its cache during k pages accesses. Proof by contradiction: Assume that FIFO is a marking algorithm for k-phase partition of any fixed sequence σ. Then FIFO should not evict any marked page during some k phase. Without a loss of generality, let’s consider a cache with k slots which are indexed by i, 1  i  k, in the order of placement into the cache. Now, suppose the first request of page x during a k-phase is the ithpage in the cache. So, this first request is hit and page x is marked after the request is processed. Then, for any remaining k-1 page requests, page x should not be evicted. Let i = 1 and there are i page faults within remaining k-1 page requests. This makes FIFO evict page x before the end of the k-phase. This contradicts our hypothesis. Therefore, FIFO is not a marking algorithm. Exercise 3.7 Show that algorithm FIFO is not a marking algorithm

More Related