Uni Ed Interference-Free Parallel, Concurrent and Distributed
Total Page:16
File Type:pdf, Size:1020Kb
Diss. ETH No. 24002 Unied Interference-free Parallel, Concurrent and Distributed Programming A thesis submitted to attain the degree of DOCTOR OF SCIENCES of ETH ZURICH (Dr. sc. ETH Zurich) presented by Mischael Schill Master of Science ETH in Computer Science born on July 26th, 1984 citizen of Winterthur, Switzerland and Austria accepted on the recommendation of Prof. Dr. Bertrand Meyer, examiner Prof. Dr. Friedemann Mattern, co-examiner Prof. Dr. Richard Paige, co-examiner Dr. Piotr Nienaltowski, co-examiner 2016 Acknowledgments. I want to thank all that helped and supported me during my studies that lead to this work. First I thank my family: my parents, Gottfried and Maria, for supporting me during my studies, and my wife, Simona, for encouraging me to pursue a PhD. Bertrand Meyer, my supervisor, who welcomed me to his research group, sup- ported me and created a fruitful environment for exciting research. His suggestions, guidance and critique encouraged me made me come up and re-think ideas until per- fection. The people working at the legendary Chair of Software Engineering: Sebastian Nanz, who taught me how to be a researcher. His gentle guidance helped me nd my area and bring ideas to paper. Chris Poskitt, who I worked with during my last year, for the many late hours of work and encouragement. Claudia, for doing everything to keep the Chair working, even things that were not her responsibility, and for the many conversations during my last year. Benjamin Morandi, who supervised my master thesis and whetted my interest for doing research. Marco T., with whom I had many interesting and hilarious conversations. Carlo, Marco P., Scott, Stephan, Andrey, Alexey, Max, Martin, Georgiana, Jason, Jiwon, and Juri. Peter Müller for providing me with a nice place to nish my thesis during the last year, and all the people in CAB H66 for welcoming me. Lastly, the examiners who took the time to read and evaluate my work: Friede- mann Mattern, who kindly agreed to be my second supervisor, Richard Paige and Piotr Nienaltowski. Funding. The research leading to these results has received funding from the Euro- pean Research Council under the European Union’s Seventh Framework Programme (FP7/2007-2013) / ERC Grant agreement no. 291389. i Contents 1 Introduction 1 1.1 Background . .1 1.2 Unication and its Challenges . .2 1.2.1 Safe usage of Shared Memory . .2 1.2.2 High-Level Data Races . .3 1.2.3 Failure . .3 1.3 Hypotheses and Contributions . .3 1.3.1 Contributions . .3 1.4 Plan of the Thesis . .4 1.4.1 State of the Art . .4 1.4.2 A distributed, object-oriented programming model . .4 1.4.3 Taking Advantage of Shared Memory . .4 2 Distributed Object-Oriented Programming Models 6 2.1 Terminology . .6 2.1.1 Node . .6 2.1.2 Network Objects . .7 2.1.3 Processor . .7 2.1.4 Region . .7 2.1.5 Features, Calls and Application . .7 2.1.6 Client / Supplier . .8 2.1.7 Communication . .8 2.2 Concurrency . .8 2.2.1 Asynchronous Calls . .9 2.2.2 Synchronous Calls . .9 2.2.3 Future Calls . .9 2.2.4 Asynchronous Replies . .9 2.2.5 Local/Remote Wait Condition . .9 2.3 Principal Problems in Concurrency and Distribution . 10 2.3.1 High-Level Data Races . 10 2.3.2 Failure . 11 2.4 Concurrent Programming Paradigms . 11 2.4.1 Threads – Classic Shared Memory . 12 2.4.2 Processes – Classic Message Passing . 12 2.4.3 Active Objects . 12 2.5 Comparison of Network Object Languages . 13 2.5.1 Evaluation . 13 2.5.2 Argus . 13 ii 2.5.3 Emerald . 14 2.5.4 Modula 3 . 15 2.5.5 CORBA . 15 2.5.6 Java RMI . 15 2.6 Comparison of Active Object Languages . 16 2.6.1 Evaluation . 16 2.6.2 Failure . 17 2.6.3 Overview . 17 2.6.4 Actor Based Concurrent Language . 19 2.6.5 Asynchronous Sequential Processes . 20 2.6.6 MultiASP . 21 2.6.7 Creol . 21 2.6.8 (J)CoBox . 23 2.6.9 E . 23 2.6.10 AmbientTalk . 24 2.6.11 Scoop ............................... 25 2.7 Conclusion . 25 3 Scoop 26 3.1 Regions and Processors . 26 3.1.1 References . 26 3.1.2 Expanded Classes . 28 3.1.3 Immutable Classes . 28 3.1.4 Processor Creation . 29 3.1.5 Passive Regions . 29 3.2 Control and non-interference . 29 3.3 Locking . 31 3.3.1 Control . 31 3.3.2 Lock Passing . 32 3.4 Blocking and Waiting . 32 3.4.1 Adaptive Synchronization . 32 3.4.2 Wait Conditions . 33 3.4.3 Attributes as Futures . 33 3.5 Agents . 33 3.6 Scoop Runtime . 34 4 Examples 36 4.1 Distributed Banking . 36 4.1.1 Architecture . 36 4.1.2 Initialization . 37 4.1.3 Classes . 38 4.2 Chat Server . 43 4.2.1 Architecture . 43 4.2.2 Initialization . 43 4.2.3 Classes . 45 4.3 Computing Cluster . 49 4.3.1 Architecture . 49 4.3.2 Initialization . 50 4.3.3 Classes . 50 iii 5 Distributed Scoop 52 5.1 From Network Objects to Distributed Scoop .............. 52 5.2 The Distributed Scoop Framework . 55 5.2.1 Components . 55 5.2.2 Mechanisms . 55 5.2.3 D-Scoop Protocol. 58 5.3 Locking Remote Objects . 60 5.3.1 Lock Passing . 63 5.4 Compensating for Failure . 63 5.5 Wait Conditions . 66 5.6 Passive Regions . 66 5.7 Examples . 66 5.7.1 Chat System: Message Exchange . 66 5.7.2 Distributed Banking: Message Exchange . 68 5.8 Semantics . 71 5.9 Evaluation . 71 5.10 Future Work . 74 5.10.1 Creation of Remote Agents . 74 5.10.2 Export . 74 5.10.3 Smarter Wait Conditions . 75 5.10.4 Explicit Synchronization . 75 5.10.5 Asynchronous Replies . 76 5.10.6 Exceptions and Compensations . 76 5.10.7 Security . 77 5.11 Conclusion . 77 6 D-Scoop Semantics 78 6.1 Introduction . 78 6.2 Semantics and Implementation . 79 6.3 Denitions and Support . 79 6.3.1 Cells . 80 6.3.2 Sets and lists . 83 6.3.3 Denitions . ..