The Design Philosophy of Distributed Programming Systems: the Mozart Experience
Total Page:16
File Type:pdf, Size:1020Kb
The Design Philosophy of Distributed Programming Systems: the Mozart Experience Per Brand A dissertation submitted to the Royal Institute of Technology in partial fulfillment of the requirements for the degree of Doctor of Philosophy June 2005 The Royal Institute of Technology School of Information and Communication Technology Department of Electronics and Computer Systems Stockholm, Sweden TRITA-IMIT-LECS AVH 05:04 ISSN 1651-4076 ISRN KTH/IMIT/LECS/AVH-05/04–SE and ISRN SICS-D–37–SE SICS Dissertation Series 37 ISSN 1101-1335 c Per Brand, 2005 Abstract Distributed programming is usually considered both difficult and inherently different from concurrent centralized programming. It is thought that the distributed program- ming systems that we ultimately deploy, in the future, when we’ve worked out all the details, will require a very different programming model and will even need to be evaluated by new criteria. The Mozart Programming System, described in this thesis, demonstrates that this need not be the case. It is shown that, with a good system design, distributed pro- gramming can be seen as an extended form of concurrent programming. This is from the programmer’s point-of-view; under the hood the design and implementation will necessarily be more complex. We relate the Mozart system with the classical trans- parencies of distributed systems. We show that some of these are inherently on the application level, while as Mozart demonstrates, others can and should be dealt with on the language/system level. The extensions to the programming model, given the right concurrent programming base, are mainly concerned with non-functional properties of programs. The models and tuning facilities for failure and performance need to take latency, bandwidth, and partial failure into account. Other than that there need not be any difference between concurrent programming and distributed programming. The Mozart Programming System is based on the concurrent programming lan- guage Oz, which integrates, in a coherent way, all three known concurrency or thread- interaction models. These are message-passing (like Erlang), shared objects (like Java with threads) and shared data-flow variables. The Mozart design philosophy is thus ap- plicable over the entire range of concurrent programming languages/systems. We have extracted from the experience with Mozart a number of principles and properties that are applicable to the design and implementation of all (general-purpose) distributed programming systems. The full range of the design and implementation issues behind Mozart are present- ed. This includes a description of the consistency protocols that make transparency possible for the full language, including distributed objects and distributed data-flow variables. Mozart is extensively compared with other approaches to distributed programming, in general, and to other language-based distributed programming systems, in particular. 3 4 Acknowlegements First and foremost I would like to thank the entire Mozart development group. It was a priviledge and pleasure to work with such a talented, creative and strong-willed group of people. The development of Mozart was very much team work, and the number of people involved in Mozart, at one time or other, was very large for an academic project. It was, I always thought, appropriate that the distributed programming system Mozart was also developed in a distributed fashion with people from SICS/KTH in Sweden DKFI/Saarland University in Germany and later UCL in Belgium. I would like to thank the people who made my frequent and lengthy visits to Saarbrucken dur- ing the early Mozart days so pleasant and rewarding - Ralf Scheidhauer, Christian Schulte, Martin Henz, Konstantin Popov, Michael Mehl and Martin Muller (and his wonderful wife Bettina). I especially want to thank Seif Haridi, my advisor, and Peter van Roy for their encouragement, friendship and insights. I will always remember, fondly, the intense but friendly discussion atmosphere that we had during the course of the Mozart project (and thereafter). I would also like to thank Gert Smolka’s group at DKFI for the development of early Oz. This gave us a good base without which Mozart would never have been realized. I want to thank Vinnova(Nutek) for their support, especially in the early days when the ground work for Mozart was laid in the Perdio project. Finally, I want to thank Sverker Janson, Erik Klintskog and Ali Ghodsi for their valuable comments on the drafts of this document. 5 6 Contents 1 Introduction 15 1.1 The Mozart Experience . 16 1.2 Overview . 18 1.3 Reading recommendations . 18 I The Mozart Programming System 21 2 Distributed Programming Languages 25 2.1 Transparency . 26 2.2 Network-transparent language . 27 2.2.1 Ordering transparencies . 27 2.2.2 Concurrency . 28 2.2.3 The Language View . 29 2.2.4 Summary . 29 2.3 Limits of Transparency . 30 2.4 Partial Failure . 31 2.4.1 Failure Transparency . 31 2.4.2 The Mozart Failure Model . 32 2.4.3 Transparency Classification . 33 2.5 The Oz Programming Language . 34 2.6 Language Extensions . 36 2.6.1 Open Computing . 36 3 Distributed Programming Systems 39 3.1 Network transparency . 40 3.1.1 The Protocol Infrastructure . 40 3.1.2 Development of Protocols . 41 3.1.3 Marshaling . 41 3.1.4 Garbage Collection . 42 3.2 Network Awareness . 43 3.2.1 Failure Model . 43 3.2.2 Efficient Local Execution . 44 3.2.3 Messaging and Network layer . 44 7 8 CONTENTS 3.2.4 Dealing with Localized Resources . 46 4 Related Work 49 4.1 The Two-Headed Beast . 49 4.1.1 Message-passing systems . 50 4.1.2 Database Approach . 51 4.2 The Language Approach . 52 4.2.1 Expressivity . 52 4.2.2 Transparency . 53 4.2.3 Network awareness . 54 4.3 Summary . 58 5 Contributions by the Author 59 II The Papers 61 6 Programming Languages for Distributed Appl. 65 6.1 Abstract . 66 6.2 Introduction . 66 6.2.1 Identifying the issues . 67 6.2.2 Towards a solution . 68 6.2.3 Outline of the article . 70 6.3 Shared graphic editor . 70 6.3.1 Logical architecture . 71 6.3.2 Client-server structure . 72 6.3.3 Cached graphic state . 73 6.3.4 Push objects and transaction objects . 73 6.3.5 Final comments . 74 6.4 Oz . 74 6.4.1 The Oz programming model . 76 6.4.2 Oz by example . 77 6.4.3 Oz and Prolog . 79 6.4.4 Oz and concurrent logic programming . 80 6.5 Distributed Oz . 81 6.5.1 The distribution graph . 82 6.5.2 Distributed logic variables . 83 6.5.3 Mobile objects . 85 6.5.4 Mobile state . 87 6.5.5 Distributed garbage collection . 89 6.6 Open computing . 91 6.6.1 Connections and tickets . 91 6.6.2 Remote compute servers . 92 6.7 Failure detection and handling . 93 CONTENTS 9 6.7.1 The containment principle . 93 6.7.2 Failures in the distribution graph . 94 6.7.3 Handlers and watchers . 95 6.7.4 Classifying possible failures . 95 6.7.5 Distributed garbage collection with failures . 95 6.8 Resource control and security . 96 6.8.1 Language security . 97 6.8.2 Implementation security . 98 6.8.3 Virtual sites . 98 6.9 Conclusion . 99 7 Mobile Objects in Distributed Oz 101 7.1 Abstract . 102 7.2 Introduction . 102 7.2.1 Object Mobility . 102 7.2.2 Two Semantics . 103 7.2.3 Developing an Application . 103 7.2.4 Mobility Control and State . 104 7.2.5 Overview of the Article . 104 7.3 A Shared Graphic Editor . 105 7.4 Language Properties . 107 7.4.1 Network Transparency . 107 7.4.2 Flexible Network Awareness . 108 7.4.3 Latency Tolerance . 108 7.4.4 Language Security . 109 7.5 Language Semantics . 110 7.5.1 Oz Programming Model . 111 7.5.2 Compound Entities . 114 7.6 Distribution Model . 119 7.6.1 Replication . 119 7.6.2 Logic Variables . 120 7.6.3 Mobility Control . 121 7.6.4 Programming with Mobility Control . 122 7.7 Cells: Semantics and Mobile State Protocol . 127 7.7.1 Cell Semantics . 127 7.7.2 The Graph Model . 130 7.7.3 Informal Description . 133 7.7.4 Formal Specification . 134 7.8 System Architecture . 137 7.8.1 Language Graph Layer . 139 7.8.2 Memory Management Layer . 140 7.8.3 Reliable Message Layer . 142 7.9 Related Work . 142 7.9.1 Distributed Shared Memory . 143 10 CONTENTS 7.9.2 Emerald . ..