Order and Containment in Concurrent System Design Copyright Fall 2000
Total Page:16
File Type:pdf, Size:1020Kb
Order and Containment in Concurrent System Design Copyright Fall 2000 by John Sidney Davis II 1 Abstract Order and Containment in Concurrent System Design by John Sidney Davis II Doctor of Philosophy in Engineering-Electrical Engineering and Computer Science University of California at Berkeley Professor Edward A. Lee, Chair This dissertation considers the dif®culty of modeling and designing complex, concurrent systems. The term concurrent is used here to mean a system consisting of a network of commu- nicating components. The term complex is used here to mean a system consisting of components with different models of computation such that the communication between different components has different semantics according to the respective interacting models of computation. Modeling and designing a concurrent system requires a clear understanding of the types of relationships that exist between the components found within a concurrent system. Two partic- ularly important types of relationships found in concurrent systems are the order relation and the containment relation. The order relation represents the relative timing of component actions within a concurrent system. The containment relation facilitates human understanding of a system by ab- stracting a system's components into layers of visibility. The consequence of improper management of the order and containment relationships in a complex, concurrent system is deadlock. Deadlock is an undesirable halting of a system's execution and is the most challenging type of concurrent system error to debug. The contents of this disserta- tion show that no methodology is currently available that can concisely, accurately and graphically 2 model both the order and containment relations found in complex, concurrent systems. The result of the absence of a method suitable for modeling both order and containment is that the prevention of deadlock is very dif®cult. This dissertation offers a solution to this problem with the introduction of the diposet. Professor Edward A. Lee Dissertation Committee Chair iii This dissertation is dedicated to O.C. Jones.1 O.C. Jones is the janitor who told me to ªkeep working hard, son.º O.C. Jones is the faculty member, with few black colleagues, who encouraged me to push forward. O.C. Jones is the church deacon, the secretary, the grocery clerk, the barber who continually whispered encouragement and shouted for educational achievement. Without O.C. Jones I would not have completed this project. 1 O.C. Jones is a ®ctional character who represents senior citizens of African descent in a fashion similar to Langston Hughes' Jesse B. Simple. I created O.C. Jones with the help of Marshell D. Jones. iv Contents List of Figures vi List of Tables viii 1 Managing Inconsistency And Complexity In Concurrent Systems 1 1.1 Component-Based Design .............................. 3 1.1.1 Object-OrientedProgramming........................ 3 1.1.2 SoftwareEngineering............................. 7 1.1.3 FormalSemantics.............................. 9 1.1.4 SystemLevelEDA.............................. 11 1.2 Abstracting Component-Based Design ........................ 12 1.3 Dissertation Outline .................................. 13 2 The Semantics of Concurrent Systems 16 2.1TheSemanticsofConcurrentPrograms....................... 16 2.1.1 ConcurrencyandOrder............................ 18 2.1.2 RepresentingConcurrentSystems...................... 20 2.1.3 Diposets................................... 26 2.1.4 TypesofOrder................................ 33 2.2DiposetsandConcurrentProgramming........................ 34 2.2.1 SafetyandSynchronization......................... 37 2.2.2 LivenessandDeadlock............................ 38 2.2.3 ConservativeCompileTimeDeadlockDetection.............. 41 2.2.4 CommunicationSemantics.......................... 43 2.2.5 An Example: PtPlot And The JavaTMSwingPackage............ 45 3 Interfacing Heterogeneous Process Models 49 3.1AssessingTheEffectivenessofanAdapter...................... 55 3.2ProcessModels.................................... 57 3.2.1 DistributedDiscreteEvent(DDE)...................... 57 3.2.2 ProcessNetworks(PN)............................ 57 3.2.3 CommunicatingSequentialProcesses(CSP)................ 58 3.3Order&AtomicProcesses.............................. 59 v 3.3.1 OrderingCommunication:EventDrivenvs.DataDriven.......... 59 3.3.2 ReorderingCommunication......................... 61 3.4Order&CompositeProcesses............................ 65 3.4.1 ConcurrentAdapters............................. 66 3.4.2 Non-DeterministicChoice:Blessing&Curse................ 67 3.4.3 TotallyOrderedEventDrivenModels.................... 68 4 Implementation 70 4.1Modeling&Design.................................. 71 4.2ThePtolemyIIArchitecture............................. 72 4.2.1 ThePtolemyIIPackages........................... 72 4.2.2 HierarchicalHeterogeneity.......................... 77 4.2.3 TheProcessPackage............................. 78 4.3HierarchicalHeterogeneityandtheProcessPackage................. 81 4.3.1 Controlling ProcessReceivers at CompositeActor Boundaries ........ 84 4.3.2 Allocating Receivers at CompositeActor Boundaries ............ 85 4.4DomainPolymorphismandReorderInvariance................... 86 5Conclusion 90 5.1PrimaryContributions................................ 91 5.2 Secondary Contributions ............................... 91 5.3FutureWork...................................... 92 5.4FinalRemarks..................................... 92 A The Semantics of Programming Languages 103 A.1AxiomaticSemantics&Predicates.......................... 104 A.2OperationalSemantics&Automata......................... 104 A.3DenotationalSemantics&Recursion......................... 106 vi List of Figures 1.1ASequentialNestedDiposet............................. 14 2.1TwoCommunicatingThreads............................. 18 2.2SequentialInterleavings................................ 19 2.3Insuf®cientPosetRepresentationsofProgram2.1.................. 22 2.4AnIntervalOrderRepresentationofProgram2.1.................. 23 2.5 A Parallel Chain Poset With No Corresponding Interval Order ........... 23 2.6AnExampleGraphandDirectedGraph....................... 24 2.7AnExamplePetriNetWithFiring.......................... 26 2.8AnExampleDiposet................................. 29 2.9AnExampleNestedDiposet............................. 30 2.10ASequentialNestedDiposet(ExplicitRepresentation)............... 31 2.11ASequentialNestedDiposet(ImplicitRepresentation)............... 35 2.12 A Nested Diposet Corresponding To Program 2.2 . ............... 36 2.13 A Possible Interleaving Of Calls To do() And undo() InProgram2.3...... 38 2.14Order/ContainmentConstraintsLeadingToDeadlock................ 40 2.15Order/ContainmentConstraintsThatDoNotLeadToDeadlock.......... 42 2.16 A Diposet Representing Asynchronous Communication ............... 44 2.17 A Diposet Representing Synchronous Communication ............... 45 2.18TheSeparateThreadsInPtPlot............................ 47 2.19 PtPlot and the JavaTMSwingEventDispatchThread................. 48 3.1ASampleEmbeddedSystem............................. 51 3.2TypesofHeterogeneity................................ 54 3.3Non-deterministicChoice............................... 58 3.4 Time-Stamped Events Awaiting Consumption by a DDE Component ........ 60 3.5 The Basic Unbounded Asynchronous Message Passing Order Constraint . .... 62 3.6 The Basic Bounded Asynchronous Message Passing Order Constraint . .... 62 3.7 The Basic Synchronous Message Passing Order Constraint ............. 63 3.8 Reorder Invariance of Unbounded PN Consumptions . ............... 64 3.9 Reorder Variance of PN Consumptions with Productions .............. 64 3.10 Reorder Variance of CSP Components ........................ 65 3.11SequentialExecutionofanAdapter......................... 66 vii 3.12 The Introduction of Deadlock Via Non-Deterministic Choice ............ 68 3.13 Totally Ordered Event Driven Models with Reorder Variant Components . .... 69 4.1ThePtolemyIIPackageStructure.......................... 73 4.2ASamplePtolemyIIGraph............................. 74 4.3ExecutionandIterationinaSamplePtolemyIIModel............... 76 4.4 Domain Polymorphism: Identical actors in the left and right systems have different communication semantics because of their directors. ............... 77 4.5HierarchicalHeterogeneityinaSamplePtolemyIIModel.............. 78 4.6 Boundary Ports and Boundary Receivers in an Opaque Composite Actor . .... 79 4.7ThePtolemyIIProcessPackage:Directors..................... 82 4.8 The Ptolemy II Process Package: Receivers ..................... 83 4.9DeadlockPotentialwithDomainPolymorphicActors................ 89 viii List of Tables 4.1ActorandBranchStateswhenaProcessisContainedbyaProcess......... 87 4.2ActorandBranchStateswhenaProcessisContainedbyaNon-Process...... 87 ix Acknowledgements I thank God for my completion of this dissertation and for all of the people who were placed in my life to help me as I made this journey. First and foremost, I thank my immediate family. I thank my father, John S. Davis, for teaching me the value of hard work and consistency and for the love of music that I inherited from him. I thank my mother, Julia A. Davis, for her curiosity and laughter and for teaching me how to have bold visions and then make them come true. I thank my brother, Jeffrey C. Davis, for teaching me compassion and sincerity and for reminding me to not forget to hit the ball.2 I thank my sister, Jennifer N.G. Davis, for teaching