Presentation is loading. Please wait.

Presentation is loading. Please wait.

Distributed Algorithms (22903) Lecturer: Danny Hendler Approximate agreement This presentation is based on the book “Distributed Computing” by Hagit attiya.

Similar presentations


Presentation on theme: "Distributed Algorithms (22903) Lecturer: Danny Hendler Approximate agreement This presentation is based on the book “Distributed Computing” by Hagit attiya."— Presentation transcript:

1 Distributed Algorithms (22903) Lecturer: Danny Hendler Approximate agreement This presentation is based on the book “Distributed Computing” by Hagit attiya & Jennifer Welch.

2 Approximate Agreement Wait-freedom: Eventually, each nonfaulty process decides.  -Agreement: All decisions are within  of each other. Validity: All decisions are within the range of the input values.

3 Approximate Agreement Algorithm: assuming input range is known Assume processes know the range from which input values are drawn: –let D be the length of this range algorithm is structured as a series of "asynchronous rounds": –exchange values via a snapshot object, one per round –compute midpoint for next round continue until spread of values is within , which requires about log 2 D/  rounds

4 Approximate Agreement Algorithm (cont’d) Constant: M= max (  log 2 (D/  ) ,1) Shared: Snapshot ASO[M] initialized to empty Local: int v ;this is p i 's estimate, initialized with p i ’s input int r ;this is the asynchronous round number values[M] ;array to store snapshots taken in M rounds Program for process i 1.For r = 1 to to M 2. update i (ASO[r], v) ;update v’s entry in the r’th snapshot object 3. values[r] := scan(ASO[r]) ;take the r’th snapshot 4. v := midpoint(values[r]) ;adjust estimate 5.return v

5 Correctness proof Lemma 1: Consider any round r < M. There exists a value, u, such that the values written to ASO[r+1] are in this range: u min(U r )max(U r )(min(U r )+u)/2(max(U r )+u)/2 elements of U r+1 are in this range

6 Handling Unknown Input Range Range might not be known. Actual range in an execution might be much smaller than maximum possible range, so number of rounds may be reduced.

7 Handling Unknown Input Range Use just one atomic snapshot object Dynamically recalculate how many rounds are needed as more inputs are revealed Skip over rounds to try to catch up to maximum observed round Only consider values associated with maximum observed round Still use midpoint

8 Approximate Agreement Algorithm (unknown inputs range) Program for process i 1.S.update i ( ) ;estimate in round 1 is my value 2.repeat 3.,…, := S.scan() ;take a snapshot 4. maxRound := max(log 2 (spread(x 0,…x n-1 )/ ε ), 1) 5. r max := max{r 0,…,r n-1 } ;maximal round number I saw so far 6. values := {v j | r j = r max, 0 ≤ j ≤ n-1} ;only consider maximal round 7. S.update i ( )) ;skip to r max +1 round 8.until rmax ≥ maxRound ;until ε - agreement is guaranteed 9.return midpoint(values) Shared: Snapshot S, each entry is of the form, initially empty Local: int v ;this is p i ’s estimate, initialized with p i ’s input int r max ;this is maximal round number I saw values ;a set of numbers

9 The algorithm is a correct wait-free implementation of approximate-agreement


Download ppt "Distributed Algorithms (22903) Lecturer: Danny Hendler Approximate agreement This presentation is based on the book “Distributed Computing” by Hagit attiya."

Similar presentations


Ads by Google