Programming Distributed Computing Systems Programming Distributed Computing Systems A Foundational Approach Carlos A. Varela TheMITPress Cambridge,Massachusetts London,England ©2013CarlosA.Varela Allrightsreserved.Nopartofthisbookmaybereproducedinanyformbyanyelectronicor mechanicalmeans(includingphotocopying,recording,orinformationstorageandretrieval) withoutpermissioninwritingfromthepublisher. MITPressbooksmaybepurchasedatspecialquantitydiscountsforbusinessorsalespromo- tional use. For information, please email [email protected] or write to Special SalesDepartment,TheMITPress,55HaywardStreet,Cambridge,MA02142. ThisbookwassetinSabonbyWestchesterBooksGroup. PrintedandboundintheUnited StatesofAmerica. LibraryofCongressCataloging-in-PublicationData Varela,CarlosA. Programmingdistributedcomputingsystems:afoundationalapproach/CarlosA.Varela. p. cm. Includesbibliographicalreferencesandindex. ISBN978-0-262-01898-2(hardcover:alk.paper) 1. Electronic data processing—Distributed processing. 2. Parallel programming (Computer science) 3.Programminglanguages(Electroniccomputers) I.Title. QA76.9.D5V374 2013 (cid:2) 005.276—dc23 2012038059 10 9 8 7 6 5 4 3 2 1 ThisbookisdedicatedwithlovetomydaughtersTatianaandCatalina. —C.A.V. Contents ForewordbyGulAgha ix Preface xi Acknowledgments xv 1 Introduction 1 2 λCalculus 11 I TheoreticalModelsofConcurrency,Distribution,andMobility 33 3 π Calculus 37 4 Actors 59 5 JoinCalculus 79 6 AmbientCalculus 95 7 FormalizingConcurrency,Distribution,andMobility 111 II ProgrammingLanguagesforDistributedandMobileComputing 139 8 ProgrammingwithProcesses 145 9 ProgrammingwithActors 165 10 ProgrammingwithJoinPatterns 205 11 SocialNetworkingExample 223 References 259 Index 267 Foreword From web services to cloud computing, sensor networks to social networking, and multiparty games to data mining, distributed computing systems have acquired a central role in computer science today. There are several good books in the area of programming distributed computing systems. Some cover a particular concurrency theory; others cover a particular programming language for distributed systems. A difficulty has been that the these works provide only a very partial view: they fail toconnecttheorywithpracticeandsometimeslimitcoveragetoonlyasinglemodel of concurrency or a single programming language for distributed systems. More- over,thefewtextbooksthathavebroadercoverageofprogrammingfordistributed computingsystemsarenowdated. CarlosVarela’sProgrammingDistributedComputingSystemsisatimelybook thatfillsthisgap.Itisthefirstbooktoexplainthebest-knownfoundationalmodelsof concurrency. These models have been used to study different aspects of distributed computing systems: autonomy, synchronization, reconfigurability, mobility. That by itself would be a significant achievement. But the book also describes how these theoretical models have been used to build programming languages for distributed computing, anditprovidesaguidetoprogramminginthem. Theunderstandingof thesetheoreticalmodelsisalsodeepenedbyprovidingacarefulcomparisonbetween them. The comparison not only strengthens the pedagogy in the book, it will be of interesttoresearchers. A major strength of Varela’s work is its accessibility. Although the book is aimedatgraduatestudents,itwillbesuitableforadvancedundergraduates,aswell as for computer scientists who are unfamiliar with the area. The treatment Varela givestotheoreticalmodelsofconcurrencyisnotoverlytechnical.Nordoeshelinger onuninterestingdetailsofprogramminglanguages,acommondeficiencyinbookson programming.Thebookincludesacarefulcomparisonofthelanguages.Itprovides avaluablecasestudyofasocialnetworkingapplication—atimelytopicthatwillbe excitingforstudents.