Distributed Algorithms
Total Page:16
File Type:pdf, Size:1020Kb
DISTRIBUTED ALGORITHMS Lecture Notes for Fall Nancy A Lynch Boaz PattShamir January Preface This rep ort contains the lecture notes used by Nancy Lynchs graduate course in Distributed Algorithms during fall semester The notes were prepared by Nancy Lynch and Teaching Assistant Boaz PattShamir The main part of this rep ort is detailed lectures notes for the regular class meetings We think the reader will nd these to b e reasonably well p olished and wewould very much appreciate comments ab out any errors or suggestions on the presentation Following these notes are the homework assignments Finallywe included an app endix that contains notes for three additional lectures that were given after the regular term was over The extra lectures cover material that did not t into the scheduled numb er of class hours These notes are in a very rough shap e Many thanks go to the students who to ok the course this semester they contributed many useful comments and suggestions on the technical content and also had a very strong inuence on the pace and level of the presentation If these notes are understandable to other audiences it is largely b ecause of the feedbackprovided by this rst audience Thanks also go to George Varghese for contributing an excellent lecture on selfstabilizing algorithms Wewould also liketoacknowledge the work of Ken Goldman and Isaac Saias in preparing earlier versions and resp ectively of the notes for this course Wewere able to reuse much of their work The students who to ok the course during those twoyears worked hard to prepare those earlier lecture notes and also deserve a lot of thanks Jennifer Welch and Mark Tuttle also contributed to earlier versions of the course Finallywewould liketo thank Joanne Talb ot for her invaluable help Nancy Lynch lynchtheorylcsmitedu Boaz PattShamir boaztheorylcsmitedu January Contents LECTURES Lecture Septemb er Intro duction to the Course The Sub ject Matter Style Overview of the Course Synchronous Network Algorithms Problem Example Leader Election in a Ring Algorithm LeLann ChangRob erts Lecture Septemb er Leader Election on a Ring cont Algorithm Hirshb ergSinclair Counterexample Algorithms Lower Bound on ComparisonBased Proto cols Leader Election in a General Network BreadthFirst Search Extensions Lecture Septemb er Shortest Paths Unweighted and Weighted Minimum Spanning Tree Maximal Indep endentSet Lecture Septemb er Link Failures The Co ordinated Attack Problem Randomized Consensus Faulty Pro cessors Stop Failures Lecture Septemb er Byzantine Failures Reducing the Communication Cost Stopping Faults The Byzantine Case The TurpinCoan Algorithm Lecture Septemb er Numb er of Pro cesses for Byzantine Agreement Byzantine Agreement in General Graphs Weak Byzantine Agreement Numb er of Rounds with Stopping Faults Lecture Octob er Numb er of Rounds With Stopping Failures cont The Commit Problem Two Phase Commit PC Threephase Commit PC Lower Bound on the Numb er of Messages Lecture Octob er Asynchronous Shared Memory Informal Mo del Mutual Exclusion Problem Dijkstras Mutual Exclusion Algorithm A Correctness Argument Lecture Octob er Dijkstras Mutual Exclusion Algorithm cont An Assertional Pro of Running Time Improved Mutual Exclusion Algorithms NoStarvation Requirements Petersons TwoPro cess Algorithm Tournament Algorithm Iterative Algorithm Lecture Octob er Atomic Ob jects Example ReadWrite Ob ject Denition Atomic Snapshots Problem Statement Unb ounded Algorithm Bounded Register Algorithm Lecture Octob er Burns Mutual Exclusion Algorithm Lamp orts Bakery Algorithm Analysis The Numb er of Registers for Mutual Exclusion Two Pro cesses and One Variable Three pro cesses and TwoVariables The General Case Lecture Octob er Consensus Using ReadWrite Shared Memory Imp ossibility for Arbitrary Stopping Faults Imp ossibility for a Single Stopping Fault Mo deling and Mo dularity for Shared Memory Systems The Basic InputOutput Automaton Mo del Lecture Octob er IO Automata cont Problem Sp ecication Pro of Techniques Shared Memory Systems as IO Automata Instantaneous Memory Access Ob ject Mo del Mo dularity Results Transforming from Instantaneous to Atomic Ob jects Comp osition in the Ob ject Mo del Lecture Octob er Mo dularity cont Waitfreedom Concurrent Timestamp Systems Denition of CTS Ob jects Bounded Lab el Implementation Correctness Pro of Application to Lamp orts Bakery Algorithm Lecture Novemb er MultiWriter Register Implementation Using CTS The Algorithm A Lemma for Showing Atomicity Pro of of the Multiwriter Algorithm Algorithms in the ReadMo difyWrite Mo del Consensus Mutual Exclusion Lecture Novemb er ReadMo difyWrite Algorithms cont Mutual Exclusion cont Other Resource Allo cation Problems Safe and Regular Registers Denitions Implementation Relationships for Registers Register Constructions Lecture Novemb er Register Constructions cont Construction Binary Regular Register from Binary Safe Register Construction K ary Regular Register from Binary Regular Register Construction Reader K ary Atomic Register from Regular Register MultiReader Atomic Registers Lamp orts Bakery Revisited Asynchronous Network Algorithms Leader Election Lecture Novemb er Leader Election in Asynchronous Rings cont The LeLannChang Algorithm cont The Hirshb ergSinclair Algorithm The Peterson Algorithm Burns Lower Bound Result Problems in General Asynchronous Networks Network Leader Election Breadthrst Search and Shortest Paths Lecture Novemb er Asynchronous BroadcastConvergecast Minimum Spanning Tree Problem Statement Connections Between MST and Other Problems The Synchronous Algorithm Review The GallagerHumbletSpira Algorithm Outline In More Detail A Summary of the Co de in the GHS Algorithm Complexity Analysis Proving Correctness for the GHS Algorithm Lecture Novemb er Minimum Spanning Tree cont Simpler Synchronous Strategy Synchronizers Synchronous Mo del HighLevel Implementation Using a Synchronizer Synchronizer Implementations Hybrid Implementation Applications Lower Bound for Synchronizers Lecture Novemb er Time Clo cks etc Logical Time Algorithms Applications Simulating Shared Memory Mutual Exclusion and Resource Allo cation Problem Denition Mutual Exclusion Algorithms Lecture Decemb er Mutual Exclusion cont Ricart Agrawala Carvalho Roucairol General Resource Allo cation BurnsLynch Algorithm Drinking Philosophers Stable Prop erty Detection Termination for Diusing Computations Snapshots Lecture Decemb er The Concept of SelfStabilization Do or Closing and Domain Restriction SelfStabilization is attractive for Networks Criticisms of SelfStabilization Denitions of Stabilization Execution Denitions Denitions of Stabilization based on External Behavior Discussion on the Stabilization Denitions Examples from Dijkstras Shared Memory Mo del Dijkstras Shared Memory Mo del and IOA Dijkstras Second Example as Lo cal Checking and Correction Dijkstras rst example as Counter Flushing Message Passing Mo del Mo deling the Top ology Mo deling Links Mo deling Network No des and Networks Implementing the Mo del in Real Networks Lo cal Checking and Correction in our Message Passing Mo del Link Subsystems and Lo cal Predicates Lo cal Checkability Lo cal Correctability Lo cal Correction Theorem Theorem Statement Overview of the Transformation Co de Intuitive Pro of of Lo cal Correction Theorem Intuition Behind Lo cal Snapshots Intuition Behind Lo cal Resets Intuition Behind Lo cal Correction Theorem Implementing Lo cal Checking in Real Networks Timer Flushing Summary Lecture Decemb er SelfStabilization and Termination SelfStabilization and Finite State Selfstabilizing Reset Proto col Problem statement