Distributed Algorithms (22903) Lecturer: Danny Hendler The Atomic Snapshot Object The Renaming Problem This presentation is based on the book “Distributed.

Slides:



Advertisements
Similar presentations
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Advertisements

Mutual Exclusion – SW & HW By Oded Regev. Outline: Short review on the Bakery algorithm Short review on the Bakery algorithm Black & White Algorithm Black.
1 © R. Guerraoui The Power of Registers Prof R. Guerraoui Distributed Programming Laboratory.
Analysis of Algorithms
Mutual Exclusion By Shiran Mizrahi. Critical Section class Counter { private int value = 1; //counter starts at one public Counter(int c) { //constructor.
Multiprocessor Synchronization Algorithms ( ) Lecturer: Danny Hendler The Mutual Exclusion problem.
CPSC 668Set 18: Wait-Free Simulations Beyond Registers1 CPSC 668 Distributed Algorithms and Systems Fall 2006 Prof. Jennifer Welch.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Fall 2011 Prof. Jennifer Welch CSCE 668 Self Stabilization 1.
1 © R. Guerraoui Implementing the Consensus Object with Timing Assumptions R. Guerraoui Distributed Programming Laboratory.
CPSC 668Set 19: Asynchronous Solvability1 CPSC 668 Distributed Algorithms and Systems Fall 2006 Prof. Jennifer Welch.
Chapter 7 Sorting Part I. 7.1 Motivation list: a collection of records. keys: the fields used to distinguish among the records. One way to search for.
CPSC 668Set 10: Consensus with Byzantine Failures1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
A Mile-High View of Concurrent Algorithms Hagit Attiya Technion.
CPSC 668Set 16: Distributed Shared Memory1 CPSC 668 Distributed Algorithms and Systems Fall 2006 Prof. Jennifer Welch.
CPSC 668Set 12: Causality1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
CPSC 668Set 17: Fault-Tolerant Register Simulations1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
Distributed Algorithms (22903) Lecturer: Danny Hendler Shared objects: linearizability, wait-freedom and simulations Most of this presentation is based.
CPSC 668Self Stabilization1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.
What Can Be Implemented Anonymously ? Paper by Rachid Guerraui and Eric Ruppert Presentation by Amir Anter 1.
This material in not in your text (except as exercises) Sequence Comparisons –Problems in molecular biology involve finding the minimum number of edit.
CPSC 668Set 11: Asynchronous Consensus1 CPSC 668 Distributed Algorithms and Systems Fall 2006 Prof. Jennifer Welch.
1 © 2006 Pearson Addison-Wesley. All rights reserved Searching and Sorting Linear Search Binary Search ; Reading p Selection Sort ; Reading p
Hagit Attiya (CS, Technion) Joint work with Rachid Guerraoui (EPFL) Eric Ruppert (York University) Partial Snapshots.
CS212: DATA STRUCTURES Lecture 10:Hashing 1. Outline 2  Map Abstract Data type  Map Abstract Data type methods  What is hash  Hash tables  Bucket.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Spring 2014 Prof. Jennifer Welch CSCE 668 Set 19: Asynchronous Solvability 1.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Fall 2011 Prof. Jennifer Welch CSCE 668 Set 18: Wait-Free Simulations Beyond Registers 1.
CS 61B Data Structures and Programming Methodology July 28, 2008 David Sun.
Atomic Snapshots. Abstract Data Types Abstract representation of data & set of methods (operations) for accessing it Implement using primitives on base.
DISTRIBUTED ALGORITHMS By Nancy.A.Lynch Chapter 18 LOGICAL TIME By Sudha Elavarti.
1 Chapter 9 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2014 Synchronization Algorithms and Concurrent Programming Synchronization.
CSC 211 Data Structures Lecture 13
DISTRIBUTED ALGORITHMS AND SYSTEMS Spring 2014 Prof. Jennifer Welch Set 11: Asynchronous Consensus 1.
1 © R. Guerraoui Regular register algorithms R. Guerraoui Distributed Programming Laboratory lpdwww.epfl.ch.
1 Consensus Hierarchy Part 1. 2 Consensus in Shared Memory Consider processors in shared memory: which try to solve the consensus problem.
Common2 extended to stacks and unbound concurrency By:Yehuda Afek Eli Gafni Adam Morrison May 2007 Presentor: Dima Liahovitsky 1.
Distributed systems Consensus Prof R. Guerraoui Distributed Programming Laboratory.
6.852: Distributed Algorithms Spring, 2008 Class 18.
Max Registers, Counters, and Monotone Circuits Keren Censor, Technion Joint work with: James Aspnes, Yale University Hagit Attiya, Technion (Slides
Asynchronous Exclusive Selection Bogdan Chlebus, U. Colorado Darek Kowalski, U. Liverpool.
Chapter 21 Asynchronous Network Computing with Process Failures By Sindhu Karthikeyan.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Fall 2011 Prof. Jennifer Welch CSCE 668 Set 16: Distributed Shared Memory 1.
Distributed Algorithms (22903) Lecturer: Danny Hendler The wait-free hierarchy and the universality of consensus This presentation is based on the book.
“Towards Self Stabilizing Wait Free Shared Memory Objects” By:  Hopeman  Tsigas  Paptriantafilou Presented By: Sumit Sukhramani Kent State University.
Searching CSE 103 Lecture 20 Wednesday, October 16, 2002 prepared by Doug Hogan.
“Distributed Algorithms” by Nancy A. Lynch SHARED MEMORY vs NETWORKS Presented By: Sumit Sukhramani Kent State University.
The Selection Algorithm : Design & Analysis [10].
1 Chapter 11 Global Properties (Distributed Termination)
Distributed Algorithms (22903) Lecturer: Danny Hendler Shared objects: linearizability, wait-freedom and simulations Most of this presentation is based.
6.852: Distributed Algorithms Spring, 2008 Class 14.
Distributed Algorithms (22903) Lecturer: Danny Hendler Approximate agreement This presentation is based on the book “Distributed Computing” by Hagit attiya.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Distributed Algorithms (22903)
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Computing with anonymous processes
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Distributed Algorithms (22903)
(Slides were added to Keren’s original presentation. DH.)
Distributed Algorithms (22903)
Distributed Algorithms (22903)
Distributed Algorithms (22903)
Distributed Algorithms (22903)
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Distributed Algorithms (22903)
Distributed Algorithms (22903)
Distributed Algorithms (22903)
Computing with anonymous processes
(Slides were added to Keren’s original presentation. DH.)
Presentation transcript:

Distributed Algorithms (22903) Lecturer: Danny Hendler The Atomic Snapshot Object The Renaming Problem This presentation is based on the book “Distributed Computing” by Hagit attiya & Jennifer Welch.

2 The Atomic snapshot object Each process has a SWMR register, which we call a segment A process may obtain an ‘atomic snapshot’ of all segments. Atomic Snapshot sequential specification Two operations are supported: 1.Update i (v), by p i, updates p i ’s segment to value v. 2.Scan, returns a vector V, where V is an n-element vector called a view (with a value for each segment). V[i] must return the value of the latest Update i operation (or the initial value if there were none) Scan returns a view of the segments array that existed at some point during the execution

3 A trivial (and wrong) algorithm Initially segment[i]=v i Scan i (S) 1.for i=1 to n 2. tmp[i]=Segment[i] 3.return Update i (S, v) 1.Segment[i]=v Why is this algorithm incorrect?

4 Atomic snapshot simulation: key algorithmic ideas (Afek, Attiya, Dolev, Gafni, Merritt, Shavit, 1993) A scan collects all segments twice (double collect) If the two collects are identical, they are a legal view What if segments change while being collected? Then we try again and again until some segment undergoes “enough” changes (we can be sure its last update started after our scan) We then use a view embedded in that update (a helping mechanism) Timestamps used to distinguish between different writes of same value

5 A wait-free simulation of atomic snapshot Initially segment[i].ts=0, segment[i].data=v i, segment[i].view= Scan i (S) 1.for all j <> i: c[j]=Segment[j] 2.while true do 3. for all j: a[j] = Segment[j] 4. for all j: b[j] = Segment[j] 5. if, for all j, a[j]=b[j] ; Comparison includes timestamp! 6. return ; Direct scan 7. else if, for some j ≠ i, b[j].ts - c[j].ts ≥ 2 8. return b[j].view ; Indirect scan Update i (S, d) 1.view:=scan() 2.Segment[i]=

6 Linearization order A direct scan is linearized immediately after the last read of its first collect An indirect scan is linearized at the same point as the direct scan whose view it borrowed. An update is linearized when it writes to its segment.

7 A proof that the algorithm for atomic snapshot is wait-free and linearizable

8 A space-bounded simulation of atomic snapshot (this algorithm is not shown in class) Instead of the unbounded timestamp, we use a handshaking mechanism between each pair of processes Processes p i, p j interact via two shared SRSW handshaking bits: h i, h j. ; Handshaking procedures for the ordered pair (pi, pj) procedure tryHS i () ; process p i tries to handshake with p j 1.h i := h j procedure tryHS j () ; process p j tries to handshake with p i 1.h j := 1-h i procedure checkHS i () process p j checks whether a handshake occurred 1.return (h i ≠ h j ) procedure checkHS j () process p j checks whether a handshake occurred 1.return (h i = h j )

9 Handshaking properties Handshaking property 1 If a checkHS i returns true, then there exists a tryHS j whose write occurs between the read of the previous tryHS i and the read of the checkHS i. Handshaking property 2 If a checkHS i returns false, then there is no tryHS j whose read and write occurs between the write of the previous tryHS i and the read of the checkHS i.

10 The bounded-space algorithm Initially segment[i].data=v i, segment[i].view= Local variable shook[j]=0 for all j We add a toggle bit to each data element Scan i (S) 1.for all j <> i shook[j] := 0 2.while true do 3. for all j ≠ i tryHS i (i,j) 4. for all j ≠ i a[j] = Segment[j] 5. for all j ≠ i b[j] = Segment[j] 6.if, for some j ≠ i, checkHS i (i,j) or (a[j].toggle ≠ a[j].toggle) 7. if (shook[j]=2) return b[j].view ; Indirect scan 8. else shook[j]=shook[j]+1 9.else if, for all j, a[j]=b[j] 10. return ; Direct scan Update i (S, d) 1.view:=scan() 2.Segment[i]=<d, view, 1-Segment[i].toggle)

The Renaming Problem Processes start with unique names from a large domain Processes should pick new names that are still distinct but that are from a smaller domain Motivation: Suppose original names are serial numbers (many digits), but we'd like the processes to share an array whose size is proportional to the actual number of existing processes

Renaming Problem Definition Termination: Eventually every nonfaulty proc p i decides on a new name y i Uniqueness: If p i and p j are distinct nonfaulty procs, then y i ≠ y j. Anonymity: Processes cannot directly use their index, only their name.

Performance of Renaming Algorithm New names should be drawn from {1,2,…,M}. We would like M to be as small as possible. Uniqueness implies M must be at least n. Due to the possibility of failures, M will actually be larger than n.

Renaming Results Algorithm for wait-free case (f = n - 1) with M = n + f = 2n - 1. Algorithm for general f with M = n + f. Lower bound that M must be at least n + 1, for the wait-free case. –Proof similar to impossibility of wait-free consensus Stronger lower bound that M must be at least n + f, if f is the number of possible failures –Proof uses algebraic topology and is related to lower bound for set consensus

Wait-free renaming algorithm Processes communicate via snapshot object Each process iteratively stores its original name and a (suggested, tentative) new name If the name suggested by p is taken, it next suggests the k'th free name, where k is its original rank

Program for process i 1.newName := 1 ;Maybe I can get the smallest name 2.While true do ;While haven’t fixed my new name 3. S.update i ( ) ;Announce new suggestion 4.,…, := S.scan() ;obtain a view 5. if (newName = s j for some j ≠ i) ;ouch, there’s a clash ; select the r’th free name, where r is my rank 6. let r be the rank of oldName in {x j ≠ empty | 0≤j≤n-1} 7. let newName be r’th integer not in {s j ≠ empty | 0≤j ≠ i ≤n-1} 8. else 9. return newName Shared: Snapshot S, each entry is of the form, initially empty Local: int oldName ;this is p i ’s original name int newName ;this is p i ’s suggested name, initially 1 Wait-free renaming algorithm (cont’d)

The algorithm is a correct wait-free implementation of renaming that requires at most 2n-1 names

18 Renaming Results Algorithm for wait-free case (f = n - 1) with M = n + f = 2n - 1. Algorithm for general f with M = n + f. Lower bound that M must be at least n + 1, for the wait-free case. –Proof similar to impossibility of wait-free consensus Stronger lower bound that M must be at least n + f, if f is the number of possible failures –Proof uses algebraic topology and is related to lower bound for set consensus