ebook img

Distributed Algorithms for Message-Passing Systems PDF

500 Pages·2013·6.47 MB·english
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Distributed Algorithms for Message-Passing Systems

Michel Raynal Distributed Algorithms for Message-Passing Systems Distributed Algorithms for Message-Passing Systems Michel Raynal Distributed Algorithms for Message-Passing Systems MichelRaynal InstitutUniversitairedeFrance IRISA-ISTIC UniversitédeRennes1 RennesCedex France ISBN978-3-642-38122-5 ISBN978-3-642-38123-2(eBook) DOI10.1007/978-3-642-38123-2 SpringerHeidelbergNewYorkDordrechtLondon LibraryofCongressControlNumber:2013942973 ACMComputingClassification(1998): F.1,D.1,B.3 ©Springer-VerlagBerlinHeidelberg2013 Thisworkissubjecttocopyright.AllrightsarereservedbythePublisher,whetherthewholeorpartof thematerialisconcerned,specificallytherightsoftranslation,reprinting,reuseofillustrations,recitation, broadcasting,reproductiononmicrofilmsorinanyotherphysicalway,andtransmissionorinformation storageandretrieval,electronicadaptation,computersoftware,orbysimilarordissimilarmethodology nowknownorhereafterdeveloped.Exemptedfromthislegalreservationarebriefexcerptsinconnection with reviews or scholarly analysis or material supplied specifically for the purpose of being entered and executed on a computer system, for exclusive use by the purchaser of the work. Duplication of this publication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher’slocation,initscurrentversion,andpermissionforusemustalwaysbeobtainedfromSpringer. PermissionsforusemaybeobtainedthroughRightsLinkattheCopyrightClearanceCenter.Violations areliabletoprosecutionundertherespectiveCopyrightLaw. Theuseofgeneraldescriptivenames,registerednames,trademarks,servicemarks,etc.inthispublication doesnotimply,evenintheabsenceofaspecificstatement,thatsuchnamesareexemptfromtherelevant protectivelawsandregulationsandthereforefreeforgeneraluse. Whiletheadviceandinformationinthisbookarebelievedtobetrueandaccurateatthedateofpub- lication,neithertheauthorsnortheeditorsnorthepublishercanacceptanylegalresponsibilityforany errorsoromissionsthatmaybemade.Thepublishermakesnowarranty,expressorimplied,withrespect tothematerialcontainedherein. Printedonacid-freepaper SpringerispartofSpringerScience+BusinessMedia(www.springer.com) Preface Laprofusiondeschosescachaitlararetédesidéesetl’usuredescroyances. [...]Retenirquelquechosedutempsoùl’onneseraplus. InLesannées(2008),AnnieErnaux Nelmezzodelcammindinostravita Miritrovaiperunaselvaoscura, Chéladirittaviaerasmarritta. InLadivinacommedia(1307–1321),DanteAlighieri(1265–1321) Wirmüssennichtssein,sondernalleswerdenwollen. JohannWolfgangvonGoethe(1749–1832) Chaquegénération,sansdoute,secroitvouéeàrefairelemonde. Lamiennesaitpourtantqu’ellenelereferapas.Maissatâcheestpeut-êtreplusgrande. Elleconsisteàempêcherquelemondenesedéfasse. SpeechattheNobelBanquet,Stockholm,December10,1957,AlbertCamus(1913–1960) Rienn’estprécairecommevivre Riencommeêtren’estpassager C’estunpeufondrepourlegivre Oupourleventêtreléger J’arriveoùjesuisétranger. InLevoyagedeHollande(1965),LouisAragon(1897–1982) What Is Distributed Computing? Distributed computing was born in the late 1970s when researchers and practitioners started taking into account the intrinsic characteristicofphysicallydistributedsystems.Thefieldthenemergedasaspecial- ized research area distinct from networking, operating systems, and parallel com- puting. Distributed computing arises when one has to solve a problem in terms of dis- tributed entities (usually called processors, nodes, processes, actors, agents, sen- sors, peers, etc.) such that each entity has only a partial knowledge of the many parametersinvolvedintheproblemthathastobesolved.Whileparallelcomputing andreal-timecomputingcanbecharacterized,respectively,bythetermsefficiency andon-timecomputing,distributedcomputingcanbecharacterizedbythetermun- certainty. This uncertainty is created by asynchrony, multiplicity of control flows, v vi Preface absenceofsharedmemoryandglobaltime,failure,dynamicity,mobility,etc.Mas- tering one form or another of uncertainty is pervasive in all distributed computing problems.Amaindifficultyindesigningdistributedalgorithmscomesfromthefact thateachentitycooperatingintheachievementofacommongoalcannothavein- stantaneous knowledge of the current state of the other entities; it can only know theirpastlocalstates. Althoughdistributedalgorithmsareoftenmadeupofafewlines,theirbehavior can be difficult to understand and their properties hard to state and prove. Hence, distributedcomputingis notonlyafundamentaltopicbutalsoachallengingtopic wheresimplicity,elegance,andbeautyarefirst-classcitizens. WhyThisBook? Whiletherearealotofbooksonsequentialcomputing(bothon basic data structures, or algorithms), this is not the case in distributed computing. Most books on distributed computing consider advanced topics where the uncer- tainty inherent to distributed computing is created by the net effect of asynchrony andfailures.Itfollowsthatthesebooksaremoreappropriateforgraduatestudents thanforundergraduatestudents. Theaimofthisbookistopresentinacomprehensivewaybasicnotions,concepts andalgorithmsofdistributedcomputingwhenthedistributedentitiescooperateby sendingandreceivingmessagesontopofanunderlyingnetwork.Inthiscase,the main difficulty comes from the physical distribution of the entities and the asyn- chronyoftheenvironmentinwhichtheyevolve. Audience This book has been written primarily for people who are not familiar withthetopicandtheconceptsthatarepresented.Theseincludemainly: • Senior-level undergraduate students and graduate students in computer science orcomputerengineering,whoareinterestedintheprinciplesandfoundationsof distributedcomputing. • Practitionersandengineerswhowanttobeawareofthestate-of-the-artconcepts, basicprinciples,mechanisms,andtechniquesencounteredindistributedcomput- ing. Prerequisites for this book include undergraduate courses on algorithms, and ba- sic knowledgeon operatingsystems. Selectionsof chaptersfor undergraduateand graduatecoursesaresuggestedinthesectiontitled“HowtoUseThisBook”inthe Afterword. Content Asalreadyindicated,thisbookcoversalgorithms,basicprinciples,and foundations of message-passing programming, i.e., programs where the entities communicatebysendingandreceivingmessagesthroughanetwork.Theworldis distributed,andthealgorithmicthinkingsuitedtodistributedapplicationsandsys- temsisnotreducibletosequentialcomputing.Knowledgeofthebasesofdistributed computingisbecomingmoreimportantthaneverasmoreandmorecomputerap- plicationsarenowdistributed.Thebookiscomposedofsixparts. Preface vii • Theaimofthefirstpart,whichismadeupofsixchapters,istogiveafeelforthe natureofdistributedalgorithms,i.e.,whatmakesthemdifferentfromsequential or parallel algorithms. To that end, it mainly considers distributed graph algo- rithms.Inthiscontext,eachnodeofthegraphisaprocess,whichhastocompute aresultwhosemeaningdependsonthewholegraph. Basic distributed algorithms such as network traversals, shortest-path algo- rithms, vertex coloring, knot detection, etc., are first presented. Then, a general frameworkfordistributedgraphalgorithmsisintroduced.Achapterisdevotedto leaderelectionalgorithmsonaringnetwork,andanotherchapterfocusesonthe navigationofanetworkbymobileobjects. • Thesecondpartisonthenatureofdistributedexecutions.Itismadeupoffour chapters.Insomesense,thispartisthecoreofthebook.Itexplainswhatadis- tributedexecutionis,thefundamentalnotionofaconsistentglobalstate,andthe impossibility—without freezing the computation—of knowing whether a com- putedconsistentglobalstatehasbeenpassedthroughbytheexecutionornot. Then,thispartofthebookaddressesanimportantissueofdistributedcompu- tations, namely the notion of logical time: scalar (linear) time, vector time, and matrixtime.Eachtypeoftimeisanalyzedandexamplesoftheirusesaregiven. A chapter, which extends the notion of a global state, is then devoted to asyn- chronous distributed checkpointing. Finally, the last chapter of this part shows how to simulate a synchronous system on top of an asynchronous system (such simulatorsarecalledsynchronizers). • The third part of the book is made up of two chapters devoted to distributed mutual exclusion and distributed resource allocation. Different families of permission-based mutual exclusion algorithms are presented. The notion of an adaptivealgorithmisalsointroduced.Thenotionofacriticalsectionwithmul- tiple entries, and the case of resources with a single or several instances is also presented.Associateddeadlockpreventiontechniquesareintroduced. • Thefourthpartofthebookisonthedefinitionandtheimplementationofcommu- nicationoperationswhoseabstractionlevelishigherthanthesimplesend/receive ofmessages.Thesecommunicationabstractionsimposeorderconstraintsonmes- sage deliveries. Causal message delivery and total order broadcast are first pre- sentedinonechapter.Then,anotherchapterconsiderssynchronouscommunica- tion(alsocalledrendezvousorlogicallyinstantaneouscommunication). • Thefifthpartofthebook,whichismadeupoftwochapters,isonthedetection ofstablepropertiesencounteredindistributedcomputing.Astablepropertyisa propertythat,oncetrue,remainstrueforever.Thepropertieswhicharestudiedare thedetectionoftheterminationofadistributedcomputation,andthedetectionof distributeddeadlock.Thispartofthebookisstronglyrelatedtothesecondpart (whichisdevotedtothenotionofaglobalstate). • The sixth and last part of the book, which is also made up of two chapters, is devoted to the notion of a distributed shared memory. The aim is here to pro- videtheentities(processes)withasetofobjectsthatallowthemtocooperateat viii Preface anabstractionlevelmoreappropriatethantheuseofmessages.Twoconsistency conditions,whichcanbeassociatedwiththeseobjects,arepresentedandinves- tigated,namely,atomicity(alsocalledlinearizability)andsequentialconsistency. Severalalgorithmsimplementingtheseconsistencyconditionsaredescribed. Tohaveamorecompletefeelingofthespiritofthisbook,thereaderis invited to consult the section “The Aim of This Book” in the Afterword, which describes what it is hoped has been learned from this book. Each chapter starts with a short presentationandalistofthemainkeywords,andterminateswithasummaryofits content.Eachofthesixpartsofthebookisalsointroducedbyabriefdescriptionof itsaimanditstechnicalcontent. Acknowledgments Thisbookoriginatesfromlecturenotesforundergraduateandgraduate coursesondistributedcomputingthatIgiveattheUniversityofRennes(France)and,asan invitedprofessor,atseveraluniversitiesallovertheworld.Iwouldliketothankthestudents fortheirquestionsthat,inonewayoranother,havecontributedtothisbook.Iwantalsoto thankRonanNugent(Springer)forhissupportandhishelpinputtingitalltogether. Lastbutnotleast(andmaybemostimportantly),Ialsowanttothankalltheresearchers whoseresultsarepresentedinthisbook.Withouttheirwork,thisbookwouldnotexist. MichelRaynal ProfesseurdesUniversités InstitutUniversitairedeFrance IRISA-ISTIC,UniversitédeRennes1 CampusdeBeaulieu,35042,Rennes,France March–October2012 Rennes,Saint-Grégoire,Tokyo,Fukuoka(AINA’12),Arequipa(LATIN’12), Reykjavik(SIROCCO’12),Palermo(CISIS’12),Madeira(PODC’12),Lisbon, Douelle,Saint-Philibert,RhodesIsland(Europar’12), SalvadordeBahia(DISC’12),MexicoCity(TuringYearatUNAM) Contents PartI DistributedGraphAlgorithms 1 BasicDefinitionsandNetworkTraversalAlgorithms . . . . . . . . . 3 1.1 DistributedAlgorithms . . . . . . . . . . . . . . . . . . . . . . . 3 1.1.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1.2 AnIntroductoryExample: LearningtheCommunicationGraph . . . . . . . . . . . . 6 1.2 ParallelTraversal:BroadcastandConvergecast . . . . . . . . . . . 9 1.2.1 BroadcastandConvergecast . . . . . . . . . . . . . . . . . 9 1.2.2 AFloodingAlgorithm . . . . . . . . . . . . . . . . . . . . 10 1.2.3 Broadcast/ConvergecastBasedonaRootedSpanningTree 10 1.2.4 BuildingaSpanningTree . . . . . . . . . . . . . . . . . . 12 1.3 Breadth-FirstSpanningTree . . . . . . . . . . . . . . . . . . . . . 16 1.3.1 Breadth-FirstSpanningTree BuiltWithoutCentralizedControl. . . . . . . . . . . . . . 17 1.3.2 Breadth-FirstSpanningTreeBuiltwithCentralizedControl 20 1.4 Depth-FirstTraversal . . . . . . . . . . . . . . . . . . . . . . . . 24 1.4.1 ASimpleAlgorithm . . . . . . . . . . . . . . . . . . . . . 24 1.4.2 Application:ConstructionofaLogicalRing . . . . . . . . 27 1.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 1.6 BibliographicNotes . . . . . . . . . . . . . . . . . . . . . . . . . 32 1.7 ExercisesandProblems . . . . . . . . . . . . . . . . . . . . . . . 33 2 DistributedGraphAlgorithms . . . . . . . . . . . . . . . . . . . . . 35 2.1 DistributedShortestPathAlgorithms . . . . . . . . . . . . . . . . 35 2.1.1 ADistributedAdaptation ofBellman–Ford’sShortestPathAlgorithm . . . . . . . . 35 2.1.2 ADistributedAdaptation ofFloyd–Warshall’sShortestPathsAlgorithm . . . . . . . 38 2.2 VertexColoringandMaximalIndependentSet . . . . . . . . . . . 42 2.2.1 OnSequentialVertexColoring . . . . . . . . . . . . . . . 42 ix x Contents 2.2.2 Distributed((cid:2)+1)-ColoringofProcesses . . . . . . . . . 43 2.2.3 ComputingaMaximalIndependentSet . . . . . . . . . . . 46 2.3 KnotandCycleDetection . . . . . . . . . . . . . . . . . . . . . . 50 2.3.1 DirectedGraph,Knot,andCycle . . . . . . . . . . . . . . 50 2.3.2 Communication Graph, Logical Directed Graph, andReachability . . . . . . . . . . . . . . . . . . . . . . . 51 2.3.3 SpecificationoftheKnotDetectionProblem . . . . . . . . 51 2.3.4 PrincipleoftheKnot/CycleDetectionAlgorithm . . . . . . 52 2.3.5 LocalVariables . . . . . . . . . . . . . . . . . . . . . . . 53 2.3.6 BehaviorofaProcess . . . . . . . . . . . . . . . . . . . . 54 2.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 2.5 BibliographicNotes . . . . . . . . . . . . . . . . . . . . . . . . . 58 2.6 ExercisesandProblems . . . . . . . . . . . . . . . . . . . . . . . 58 3 AnAlgorithmicFramework toComputeGlobalFunctionsonaProcessGraph. . . . . . . . . . . 59 3.1 DistributedComputationofGlobalFunctions. . . . . . . . . . . . 59 3.1.1 TypeofGlobalFunctions . . . . . . . . . . . . . . . . . . 59 3.1.2 ConstraintsontheComputation . . . . . . . . . . . . . . . 60 3.2 AnAlgorithmicFramework . . . . . . . . . . . . . . . . . . . . . 61 3.2.1 ARound-BasedFramework . . . . . . . . . . . . . . . . . 61 3.2.2 WhentheDiameterIsNotKnown . . . . . . . . . . . . . 64 3.3 DistributedDeterminationofCutVertices . . . . . . . . . . . . . 66 3.3.1 CutVertices . . . . . . . . . . . . . . . . . . . . . . . . . 66 3.3.2 AnAlgorithmDeterminingCutVertices . . . . . . . . . . 67 3.4 ImprovingtheFramework . . . . . . . . . . . . . . . . . . . . . . 69 3.4.1 TwoTypesofFiltering . . . . . . . . . . . . . . . . . . . . 69 3.4.2 AnImprovedAlgorithm . . . . . . . . . . . . . . . . . . . 70 3.5 TheCaseofRegularCommunicationGraphs . . . . . . . . . . . . 72 3.5.1 TradeoffBetweenGraphTopologyandNumberofRounds 72 3.5.2 DeBruijnGraphs . . . . . . . . . . . . . . . . . . . . . . 73 3.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 3.7 BibliographicNotes . . . . . . . . . . . . . . . . . . . . . . . . . 76 3.8 Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 4 LeaderElectionAlgorithms . . . . . . . . . . . . . . . . . . . . . . . 77 4.1 TheLeaderElectionProblem . . . . . . . . . . . . . . . . . . . . 77 4.1.1 ProblemDefinition. . . . . . . . . . . . . . . . . . . . . . 77 4.1.2 AnonymousSystems:AnImpossibilityResult . . . . . . . 78 4.1.3 BasicAssumptionsandPrinciples oftheElectionAlgorithms. . . . . . . . . . . . . . . . . . 79 4.2 ASimpleO(n2)LeaderElectionAlgorithm forUnidirectionalRings . . . . . . . . . . . . . . . . . . . . . . . 79 4.2.1 ContextandPrinciple . . . . . . . . . . . . . . . . . . . . 79 4.2.2 TheAlgorithm . . . . . . . . . . . . . . . . . . . . . . . . 80 4.2.3 TimeCostoftheAlgorithm . . . . . . . . . . . . . . . . . 80

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.