ebook img

Glint, Breeding Mobile Ambients with Actors - Wellquite.org PDF

122 Pages·2006·0.93 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 Glint, Breeding Mobile Ambients with Actors - Wellquite.org

UniversityofLondon ImperialCollegeofScience,TechnologyandMedicine DepartmentofComputing Glint: Breeding Mobile Ambients with Actors Final Report Matthew Sackman Supervisor: Susan Eisenbach Second Marker: Sophia Drossopoulou Copyright©MatthewSackman,2006. Allrightsreserved. Copyright©MatthewSackman,2006. Allrightsreserved. [email protected] Thisreport,allsourcecodeandotherdocumentationrelatingtothisprojectisavailablefrom http://www.wellquite.org/glint/ TypesetinLATEX2ε usingMonotypePlantin®andAdobeMyriad® ThisreportisbroughttoyoubyEmacs,DasKeyboard,TCP/IPandtheletterQ.  Abstract Software Engineering is facing a crisis. Hardware designers are no longer able to make ever faster single-threaded CPUs and are instead building CPUs with thread-level parallelism. Simultaneously, clusters of computers are becoming far morepopularforbuildinghighperformancesystemsbutmakinggooduseofthese parallel and distributed systems is difficult to achieve with current tools. Mobile computationisalsobecomingincreasinglyimportantascomputersshrinkinsize andbecomephysicallymoreportable. Engineeringapplicationsthatcanmigrate betweendevicesandshareresourcesisaverydifficulttaskgiventhecurrenttools, platformsandlanguagesavailable. The methodologies and techniques for addressing the issues of concurrent, distributedandmobilecomputationarebadlyunderdevelopedandunsuitablefor thelargesoftwaresystemsbeingbuilttoday. Typicallockingmechanismsinmod- ern programming languages are problematic and unsafe to use in large software systemsbecauseoftheinabilitytoanalysesuccessfullytheiruseandbecausethey arenotsafeincomposition. Distributedandmobilecomputationissimilarlybadly addressedbymostprogramminglanguageswhichoftenpresentcomplexandmis- leadingnotionsofmobility. ThisreportpresentstheGVM,aninterpreterfortheSafeBoxedAmbient calculus of Merro and Sassone. Ambient calculi are designed to model concur- rent,distributedandmobilecomputationbutwithsomeadaptationIusethemas anassemblylanguageforavirtualmachine. IaddmobilitytotheActorparadigm of Hewitt and Agha and present the G language based on the Actor model. The Actor model was similarly designed with concurrency and distribution in mind but is a more powerful abstraction, is more expressive than the Ambient calculi and is hence more suited for programming. I then present a compiler which translates from the G language to the Safe Boxed Ambient calculus whichcanthenbeinterpretedbytheGVM. Thiscompletetoolchainofalanguage,compilerandinterpretercontributesto therangeoftoolsandtechniquesthatareavailablefortacklingtheparallelarchi- tecturesandthechallengesofmobileanddistributedcomputation. Theresulting programming model is better suited for these purposes and more concisely and powerfullyexpressesmovementthanexistinglanguagessuchasJ.   Acknowledgements Thisprojectwouldnothavebeenpossiblewithouttheinputfrommany,ofwhom here,Ihavememorytothankjustafew. Firstlymysupervisor,SusanEisenbach forallowingmeconsiderablefreereigninmyworkonthisprojectandfortelling mewhentowalkawaybeforehospitalisationbecamenecessary. Many thanks to Amy for tolerating the endless late nights, deterioration of my ability to hold a normal conversation and general coping with my devolution into something socially more primitive. Thanks too for Sophia Drossopoulou’s insistencethattheimplementationofahighlyconcurrentandcomplexsystemis notsomethingtotrivialiseaway. Tim Wood for superb knowledge of J as ever along with Tristan Allwood, Marc Hull, Steve Zymler, Francis Russell and others for inspiring and insightful conversationandpoliticaldebate. ThankstotheSgroupfortheircriticaland goodnaturedgrillingandthankstoWillKnottenbeltforpermittingmeaccessto his high performance cluster. Thanks too to the French Alps for being suitably covered in snow and for providing a sufficiently soft landing after an eight-foot unsighteddrop...   Contents 1 Introduction  1.1 BackgroundandContext . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 ReportStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 AmbientCalculi  2.1 MobileAmbients . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.1 Communication. . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.2 ObjectiveandSubjectivemoves . . . . . . . . . . . . . . . . . . . . . 2.1.3 Objectiveopen . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 BoxedAmbients . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 CommunicationInterference . . . . . . . . . . . . . . . . . . . . . . . 2.4 TypingAmbients . . . . . . . . . . . . . . . . . . . . . . . . . . .  2.4.1 TypingMobileAmbients . . . . . . . . . . . . . . . . . . . . . .  2.4.1.1 ExchangeTypes . . . . . . . . . . . . . . . . . . . . . . . .  2.4.1.2 OpeningControl . . . . . . . . . . . . . . . . . . . . . . . .  2.4.1.3 CrossingControl. . . . . . . . . . . . . . . . . . . . . . . .  2.4.2 TypingBoxedAmbients. . . . . . . . . . . . . . . . . . . . . . .  2.4.2.1 Typingprocesscommunication . . . . . . . . . . . . . . . . . .  2.4.2.2 TypingAmbientmobility. . . . . . . . . . . . . . . . . . . . .  2.5 TheChannelAmbientSystem . . . . . . . . . . . . . . . . . . . . . .  2.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  3 Actors  3.1 BasicConcepts. . . . . . . . . . . . . . . . . . . . . . . . . . . .  3.2 BenefitsofActors. . . . . . . . . . . . . . . . . . . . . . . . . . .  3.2.1 SharedMutableState. . . . . . . . . . . . . . . . . . . . . . . .  3.2.1.1 TransactionalMemory. . . . . . . . . . . . . . . . . . . . . .  3.2.2 UnsharedMutableState. . . . . . . . . . . . . . . . . . . . . . .  3.3 Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . .  3.3.1 S . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  3.3.2 E . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  3.3.3 S. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  3.3.3.1 ContinuationBasedProgramming . . . . . . . . . . . . . . . . .  3.3.3.2 TokenPassingContinuations . . . . . . . . . . . . . . . . . . .  3.3.3.3 JoinContinuations . . . . . . . . . . . . . . . . . . . . . . .  3.3.3.4 FirstClassContinuations. . . . . . . . . . . . . . . . . . . . .  3.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4 TheGLINTVM  4.1 WhichAmbientcalculus? . . . . . . . . . . . . . . . . . . . . . . . .  4.1.1 FromLATEXtoA . . . . . . . . . . . . . . . . . . . . . . . .   4.2 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4.3 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4.3.1 FromStatictoDynamic. . . . . . . . . . . . . . . . . . . . . . .  4.3.2 Substitutions,Namesandα-conversions. . . . . . . . . . . . . . . . .  4.3.3 Hosts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4.4 TestingNon-determinism. . . . . . . . . . . . . . . . . . . . . . . .  4.5 ProcessContainers . . . . . . . . . . . . . . . . . . . . . . . . . .  4.5.1 Ambients . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4.5.2 Restriction. . . . . . . . . . . . . . . . . . . . . . . . . . . .  4.6 Replication . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4.7 PairingsandRendezvous . . . . . . . . . . . . . . . . . . . . . . . .  4.7.1 Mobility. . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4.7.2 Communication. . . . . . . . . . . . . . . . . . . . . . . . . .  4.7.2.1 LocalInput,LocalOutput . . . . . . . . . . . . . . . . . . . .  4.7.2.2 LocalInput,ParentOutput . . . . . . . . . . . . . . . . . . . .  4.7.2.3 ParentInput,LocalOutput . . . . . . . . . . . . . . . . . . . .  4.7.2.4 LocalInput,ChildOutput . . . . . . . . . . . . . . . . . . . .  4.7.2.5 ChildInput,LocalOutput . . . . . . . . . . . . . . . . . . . .  4.7.3 ModellingthePairingMechanism . . . . . . . . . . . . . . . . . . .  4.8 Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4.9 Inter-hostMobility . . . . . . . . . . . . . . . . . . . . . . . . . .  4.10 InteractingwiththeRealWorld . . . . . . . . . . . . . . . . . . . . .  4.10.1 Println. . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4.10.2 Readln. . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4.11 TechnologiesEmployed . . . . . . . . . . . . . . . . . . . . . . . .  4.12 Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . . .  5 TheGLINTLanguage  5.1 TheSuitabilityofActors . . . . . . . . . . . . . . . . . . . . . . . .  5.2 ModifyingActors. . . . . . . . . . . . . . . . . . . . . . . . . . .  5.3 ComponentsoftheGLanguage . . . . . . . . . . . . . . . . . . .  5.3.1 ActorTypes,VariablesandAssignment . . . . . . . . . . . . . . . . .  5.3.2 ActorInstancesandSingletonActors . . . . . . . . . . . . . . . . . .  5.3.3 MethodCalls. . . . . . . . . . . . . . . . . . . . . . . . . . .  5.3.4 WhereClauses . . . . . . . . . . . . . . . . . . . . . . . . . .  5.3.5 BecomingDeath . . . . . . . . . . . . . . . . . . . . . . . . .  5.3.6 SimpleMethods. . . . . . . . . . . . . . . . . . . . . . . . . .  5.3.7 ComplexMethods . . . . . . . . . . . . . . . . . . . . . . . . .  5.4 Puttingitalltogether. . . . . . . . . . . . . . . . . . . . . . . . . .  5.4.1 AnonymousInnerActors . . . . . . . . . . . . . . . . . . . . . .  5.4.2 Movement. . . . . . . . . . . . . . . . . . . . . . . . . . . .  5.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  5.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  6 TheGLINTCompiler  6.1 TransformingtheAST. . . . . . . . . . . . . . . . . . . . . . . . .  6.1.1 CheckingMethodDefinitions. . . . . . . . . . . . . . . . . . . . .  6.1.2 CheckingforVariableDefinitions . . . . . . . . . . . . . . . . . . .  6.1.3 CheckingforCyclesinVariableDefinitions. . . . . . . . . . . . . . . .  6.1.4 RewritingPredicatesandConstructorCalls . . . . . . . . . . . . . . .  6.1.5 RewritingInlineStuff. . . . . . . . . . . . . . . . . . . . . . . .  6.1.6 MovingtheWhereClauses. . . . . . . . . . . . . . . . . . . . . .  6.1.7 FurtherModifyingPredicates. . . . . . . . . . . . . . . . . . . . .  6.1.8 ReorderingVariableDefinitions . . . . . . . . . . . . . . . . . . . .  6.1.9 CreatingAmbientGenerators. . . . . . . . . . . . . . . . . . . . .   6.2 EncodingintoAmbients . . . . . . . . . . . . . . . . . . . . . . . .  6.2.1 BasicPropertiesoftheEncoding . . . . . . . . . . . . . . . . . . .  6.2.2 MarshallingCallers . . . . . . . . . . . . . . . . . . . . . . . .  6.2.3 ChangingBehaviours. . . . . . . . . . . . . . . . . . . . . . . .  6.2.4 ReceivingMethodCalls . . . . . . . . . . . . . . . . . . . . . . .  6.2.5 MethodCallers . . . . . . . . . . . . . . . . . . . . . . . . . .  6.2.6 EncodingBecome . . . . . . . . . . . . . . . . . . . . . . . . .  6.2.7 LocalMethodCalls . . . . . . . . . . . . . . . . . . . . . . . .  6.2.8 AnonymousInnerActors . . . . . . . . . . . . . . . . . . . . . .  6.2.9 MethodswithPredicates. . . . . . . . . . . . . . . . . . . . . . .  6.2.10 TrueandFalse. . . . . . . . . . . . . . . . . . . . . . . . . .  6.2.11 EncodingNumbers . . . . . . . . . . . . . . . . . . . . . . . .  6.2.12 EqualityTesting . . . . . . . . . . . . . . . . . . . . . . . . .  6.3 TechnologiesEmployed . . . . . . . . . . . . . . . . . . . . . . . .  6.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  7 Evaluation  7.1 Two-tieredDesign . . . . . . . . . . . . . . . . . . . . . . . . . .  7.2 TheGVM. . . . . . . . . . . . . . . . . . . . . . . . . . . .  7.3 TheGLanguage . . . . . . . . . . . . . . . . . . . . . . . . .  7.4 TheChannelAmbientSystem . . . . . . . . . . . . . . . . . . . . . .  7.5 Performance. . . . . . . . . . . . . . . . . . . . . . . . . . . . .  7.5.1 CustomGVMCode . . . . . . . . . . . . . . . . . . . . . .  7.5.1.1 Sequential-SequentialCommunication. . . . . . . . . . . . . . . .  7.5.1.2 Parallel-SequentialCommunication . . . . . . . . . . . . . . . . .  7.5.1.3 Parallel-ParallelCommunication . . . . . . . . . . . . . . . . . .  7.5.1.4 LocalMovement . . . . . . . . . . . . . . . . . . . . . . . .  7.5.1.5 Inter-hostMovement . . . . . . . . . . . . . . . . . . . . . .  7.5.2 GeneratedGVMCode . . . . . . . . . . . . . . . . . . . . .  7.5.2.1 MethodCalls . . . . . . . . . . . . . . . . . . . . . . . . .  7.5.2.2 LocalMethodCalls . . . . . . . . . . . . . . . . . . . . . . .  7.5.2.3 Inter-hostMethodCalls . . . . . . . . . . . . . . . . . . . . .  7.5.3 ComparisonwithJ . . . . . . . . . . . . . . . . . . . . . . .  7.5.4 Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . .  8 Conclusion  8.1 Ambients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8.2 Actors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8.3 FutureWork. . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8.3.1 ImprovingtheGVM . . . . . . . . . . . . . . . . . . . . . .  8.3.1.1 GarbageCollection . . . . . . . . . . . . . . . . . . . . . . .  8.3.1.2 DebuggingandInspection . . . . . . . . . . . . . . . . . . . .  8.3.1.3 SecurityofCommunicationandInter-SystemInteraction. . . . . . . . .  8.3.1.4 TypingsintheGVM. . . . . . . . . . . . . . . . . . . . .  8.3.2 ExtendingtheGLanguage . . . . . . . . . . . . . . . . . . . .  8.3.2.1 AsynchronousMessages . . . . . . . . . . . . . . . . . . . . .  8.3.2.2 Interfaces. . . . . . . . . . . . . . . . . . . . . . . . . . .  8.3.2.3 TypeSystems . . . . . . . . . . . . . . . . . . . . . . . . .  8.3.2.4 NamedParameters . . . . . . . . . . . . . . . . . . . . . . .  8.3.2.5 Currying. . . . . . . . . . . . . . . . . . . . . . . . . . .  8.3.2.6 Traits . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8.3.2.7 LibrariesandErrorHandling . . . . . . . . . . . . . . . . . . .  8.3.3 RedesigningtheEncoding . . . . . . . . . . . . . . . . . . . . . .  8.4 FinalThoughts. . . . . . . . . . . . . . . . . . . . . . . . . . . .   Bibliography  A MeaninglessMetrics  B EmailServer  B.1 Email . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  B.2 Mailbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  B.3 CentralEmailServer . . . . . . . . . . . . . . . . . . . . . . . . .  B.4 ComparingtoJ . . . . . . . . . . . . . . . . . . . . . . . . . .  C LTSATutorial  D UsingtheGLINTVMandCompiler  D.1 UsingtheGVM . . . . . . . . . . . . . . . . . . . . . . . . .  D.2 UsingtheGCompiler . . . . . . . . . . . . . . . . . . . . . . .  

Description:
Feb 6, 2010 which translates from the G language to the Safe Boxed Ambient calculus which can then be interpreted by the GVM.
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.