A.I. Technical Report No. 1627 March 1993
Implementing Distributed Systems Using Linear Naming
Alan Bawden [email protected]
This publication can be retrieved by anonymous ftp to publications.ai.mit.edu.
Abstract
Linear graph reduction is a simple computational model in which the cost of naming things is explicitly represented. The key idea is the notion of linearity. A name is linear if it is only used once, so with linear naming you cannot create more than one outstanding reference to an entity. As a result, linear naming is cheap to support and easy to reason about.
Programs can be translated into the linear graph reduction model such that linear names in the program are implemented directly as linear names in the model. Nonlin- ear names are supported by constructing them out of linear names. The translation thus exposes those places where the program uses names in expensive, nonlinear ways.
Two applications demonstrate the utility of using linear graph reduction: First, in the area of distributed computing, linear naming makes it easy to support cheap cross-network references and highly portable data structures, Linear naming also facilitates demand driven migration of tasks and data around the network without requiring explicit guidance from the programmer.
Second, linear graph reduction reveals a new characterization of the phenomenon of state. Systems in which state appears are those which depend on certain global system properties. State is not a localizable phenomenon, which suggests that our usual object oriented metaphor for state is awed.
c
Alan Bawden, 1993
The author hereby grants to MIT permission to reproduce and to distribute copies of this thesis document in whole or in part.
Contents
1 Introduction 9
1.1 Linearity : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 10 1.1.1 What is it? : : : : : : : : : : : : : : : : : : : : : : : : : : : : 10 1.1.2 Why is it called \linearity"? : : : : : : : : : : : : : : : : : : : 12 1.1.3 Why is linearity important? : : : : : : : : : : : : : : : : : : : 13 1.1.4 Why not just use -calculus? : : : : : : : : : : : : : : : : : : 15 1.2 Application to distributed computing : : : : : : : : : : : : : : : : : : 16 1.2.1 The state of the art : : : : : : : : : : : : : : : : : : : : : : : : 16 1.2.2 A unied approach : : : : : : : : : : : : : : : : : : : : : : : : 18 1.2.3 Continuations and location transparency : : : : : : : : : : : : 19 1.2.4 The streaming problem, demand migration and tasks : : : : : 19 1.2.5 Results: : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 21 1.3 Application to the problem of state : : : : : : : : : : : : : : : : : : : 21 1.4 Outline: : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 23
2 Linear Graph Reduction 25
2.1 Linear graphs : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 25 2.2 Linear graph grammars : : : : : : : : : : : : : : : : : : : : : : : : : : 26 2.3 Graph expressions: : : : : : : : : : : : : : : : : : : : : : : : : : : : : 28 2.4 Modeling real systems : : : : : : : : : : : : : : : : : : : : : : : : : : 29 2.4.1 Representing linear structures : : : : : : : : : : : : : : : : : : 30 2.4.2 Representing nonlinear structures : : : : : : : : : : : : : : : : 30 2.4.3 Representing objects with state : : : : : : : : : : : : : : : : : 32 2.4.4 Representing input/output behavior: : : : : : : : : : : : : : : 35
3 Compiling Scheme 37
3.1 Vertex types for the Scheme run-time : : : : : : : : : : : : : : : : : : 38 3.1.1 Objects : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 38 3.1.2 Messages: : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 41 3.1.2.1 Operations : : : : : : : : : : : : : : : : : : : : : : : 42 3.1.3 Atoms : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 43 3.1.3.1 Globals : : : : : : : : : : : : : : : : : : : : : : : : : 44 3.1.4 Futures : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 47 3.2 Translating Scheme constructs : : : : : : : : : : : : : : : : : : : : : : 48 3.2.1 BEGIN : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 52
3
3.2.2 IF : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 53 3.2.3 FUTURE : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 55 3.2.4 LETREC : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 56 3.3 Optimization: simulation : : : : : : : : : : : : : : : : : : : : : : : : : 58 3.4 A real example : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 62 3.5 Code generation : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 68 3.6 Summary : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 70
4 Maintaining Connections Across the Network 73
4.1 The contract of a link: : : : : : : : : : : : : : : : : : : : : : : : : : : 74 4.2 The link maintenance protocol : : : : : : : : : : : : : : : : : : : : : : 76 4.2.1 Link maintenance data structures : : : : : : : : : : : : : : : : 77 4.2.2 Link layer communication : : : : : : : : : : : : : : : : : : : : 78 4.2.3 Creating a new link : : : : : : : : : : : : : : : : : : : : : : : : 78 4.2.4 Destroying a link : : : : : : : : : : : : : : : : : : : : : : : : : 78 4.2.5 Moving one end of a link : : : : : : : : : : : : : : : : : : : : : 79 4.2.6 Reclaiming link records: : : : : : : : : : : : : : : : : : : : : : 80 4.3 Proof of correctness : : : : : : : : : : : : : : : : : : : : : : : : : : : : 81 4.4 Examples : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 83 4.4.1 There and back again: : : : : : : : : : : : : : : : : : : : : : : 83 4.4.2 Follow the leader : : : : : : : : : : : : : : : : : : : : : : : : : 84 4.4.3 Wandering around away from home : : : : : : : : : : : : : : : 85 4.4.4 Everybody leaves home: : : : : : : : : : : : : : : : : : : : : : 86 4.4.5 Confusion reigns : : : : : : : : : : : : : : : : : : : : : : : : : 87 4.5 Analysis and possible improvements : : : : : : : : : : : : : : : : : : : 89 4.6 Summary : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 90
5 Distributed Execution 93
5.1 Run-time modules : : : : : : : : : : : : : : : : : : : : : : : : : : : : 93 5.2 Two examples : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 97 5.2.1 The source code : : : : : : : : : : : : : : : : : : : : : : : : : : 97 5.2.2 First example : : : : : : : : : : : : : : : : : : : : : : : : : : : 100 5.2.3 Second example : : : : : : : : : : : : : : : : : : : : : : : : : : 105 5.3 Migration heuristics: : : : : : : : : : : : : : : : : : : : : : : : : : : : 110 5.3.1 The heuristics : : : : : : : : : : : : : : : : : : : : : : : : : : : 112 5.3.2 The example revisited : : : : : : : : : : : : : : : : : : : : : : 114 5.4 Summary : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 116
6 State 121
6.1 What is state?: : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 122 6.2 The symptoms of state : : : : : : : : : : : : : : : : : : : : : : : : : : 124 6.2.1 Symptom: nondeterminism : : : : : : : : : : : : : : : : : : : 124 6.2.2 Symptom: cycles : : : : : : : : : : : : : : : : : : : : : : : : : 125
6.3 Locality : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 128 6.3.1 Homomorphisms and local indistinguishability : : : : : : : : : 129 6.3.2 Methods : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 130 6.4 Implications for programs : : : : : : : : : : : : : : : : : : : : : : : : 133 6.4.1 The parable of the robot : : : : : : : : : : : : : : : : : : : : : 134 6.5 The object metaphor : : : : : : : : : : : : : : : : : : : : : : : : : : : 135 6.6 Summary : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 136
7 Conclusion 139
7.1 Relation to other work : : : : : : : : : : : : : : : : : : : : : : : : : : 139 7.1.1 Linear naming: : : : : : : : : : : : : : : : : : : : : : : : : : : 139 7.1.2 Graph reduction : : : : : : : : : : : : : : : : : : : : : : : : : 141 7.1.3 Distributed computing : : : : : : : : : : : : : : : : : : : : : : 142 7.1.3.1 Explicit locations : : : : : : : : : : : : : : : : : : : : 142 7.1.3.2 Location independent object names : : : : : : : : : : 143 7.1.3.3 Unied naming : : : : : : : : : : : : : : : : : : : : : 143 7.1.4 Programming language semantics : : : : : : : : : : : : : : : : 144 7.1.5 The target/tail protocol : : : : : : : : : : : : : : : : : : : : 145 7.1.6 Thinking about state : : : : : : : : : : : : : : : : : : : : : : : 145 7.2 Future research : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 146 7.2.1 Linearity: : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 146 7.2.2 Linear graph reduction : : : : : : : : : : : : : : : : : : : : : : 146 7.2.3 Programming languages : : : : : : : : : : : : : : : : : : : : : 147 7.2.4 Garbage collection : : : : : : : : : : : : : : : : : : : : : : : : 148 7.2.5 Distributed computing : : : : : : : : : : : : : : : : : : : : : : 149 7.2.6 State : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 149 7.3 Contributions : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 150