A Programming Model and Language for Concurrent and Distributed Object-Oriented Systems

A Programming Model and Language for Concurrent and Distributed Object-Oriented Systems

A Programming Model and Language for Concurrent and Distributed Object-Oriented Systems Jan Schäfer Vom Fachbereich Informatik der Technischen Universität Kaiserslautern zur Verleihung des akademischen Grades Doktor-Ingenieur (Dr.-Ing.) genehmigte Dissertation Datum der wissenschaftlichen Aussprache: 5. November 2010 Dekan: Prof. Dr. Karsten Berns Vorsitzender der Promotionskommission: Prof. Dr. Reinhard Gotzhein Erster Berichterstatter: Prof. Dr. Arnd Poetzsch-Heffter Zweiter Berichterstatter: Prof. Dr. Einar Broch Johnsen D 386 Cover image: http://www.flickr.com/photos/handersongomes/2471526525/ (c) Handerson Gomes under the Creative Commons Licence (CC BY 2.0) http://creativecommons.org/licenses/by/2.0/deed.en To my family Abstract The wide availability of multi-core processors and the ubiquitous presence of the Internet lead to new challenges in software design and implementation. Software has to be written in a parallelizable way to profit from multiple cores. Interaction with distributed Internet services requires coping with message delays and network failures. These challenges reach application domains, like desktop applications, which have been mainly written in a sequential way in the past. The concurrency model of mainstream object-oriented programming languages is based preemptively scheduled threads, which concurrently work on a shared object-heap. This programming model is highly prone to race conditions, i.e., hard to find concurrency-related errors that are not easily reproducible. To synchronize threads and prevent data races, operating system mechanisms like locks have to be used. Experience shows that this programming model is too difficult for most programmers, is not very modular, and is not well suited for the behavioral description of software components. Furthermore, the thread-based model is not appropriate for realizing distributed systems, due to its inherent synchronous communication model. This thesis proposes a novel programming model for concurrent and distributed, object-oriented systems. The so-called cobox model generalizes the concept of active objects to concurrent, object-oriented runtime components, called coboxes. CoBoxes have their own, local object-heap, which cannot be directly accessed by other coboxes. CoBoxes communicate by asynchronous method calls with standard objects as targets, where multiple objects of a single cobox can be used for interaction. Computations inside coboxes happen via standard object-oriented programming, combined with co- operative multi-tasking. The thesis at hand presents a formalization of the semantics of the cobox model in a core calculus. The calculus is proved type-sound and several additional properties are formally covered. The dynamic semantics of the core calcu- lus is implemented in the rewriting logic framework Maude. In addition, the cobox model is realized in a practical programming language called JCoBox, which extends standard sequential Java. JCoBox is implemented by a Java compiler extension as well as a JVM bytecode rewriter. The performance of JCoBox can compete with state-of-the-art actor implementations for the JVM. The practicability of the proposed programming model and language is evaluated by the design and implementation of several concurrent applications. Zusammenfassung Die breite Verfügbarkeit von Mehrkernprozessoren und die Allgegenwärtigkeit des Internets führt zu neuen Herausforderungen für das Design und die Implemen- tierung von Software. Diese Herausforderungen erreichen Softwaredomänen, wie Desktop-Anwendungen, in denen in der Vergangenheit hauptsächlich sequenziell und rechnerlokal programmiert wurde. Damit Software von mehreren Kernen profi- tieren kann, muss sie nebenläufig geschrieben werden. Die Interaktion mit verteilten Internet-Services verlangt die Behandlung von Nachrichtenverzögerungen und Netzw- erkausfällen. Das Nebenläufigkeitsmodell von etablierten objektorientierten Program- miersprachen bietet hier dem Programmierer wenig Unterstützung. Es basiert in der Regel auf preemptiven Threads, die über gemeinsamen Speicher kommunizieren und Daten austauschen. Dieses Programmiermodell ist hochgradig anfällig für Wettlaufsi- tuationen, die zu schwer auffindbaren Nebenläufigkeitsfehler führen. Die Erfahrung zeigt, dass dieses Programmiermodell zu schwierig für die meisten Softwareentwick- ler und -entwicklerinnen ist. Es ist des weiteren nicht besonders modular und nicht gut geeignet für die verteilte Programmierung, wegen ihres inhärenten, synchronen Kommunikationsmodells. Die vorliegende Arbeit schlägt ein neues Programmiermodell für nebenläufige und verteilte, objektorientierte Systeme vor. Das sogenannte CoBox-Modell verallgemein- ert das Konzept der Aktiven Objekte hin zu objektorientierten Laufzeitkomponen- ten, genannt CoBoxen. CoBoxen besitzen ihren eigenen, lokalen Objekt-Speicher, welcher von anderen CoBoxen nicht direkt zugreifbar ist. CoBoxen kommunizieren mittels asynchroner Methodenaufrufe, die sich an normale Objekte richten, wobei mehrere Objekte einer einzelnen CoBox zur Interaktion verwendet werden können. Berechnungen innerhalb einer CoBox geschehen mittels normaler objektorientierter Programmierung, kombiniert mit kooperativen Multi-Tasking. Die vorliegende Arbeit präsentiert eine Formalisierung der Semantik des CoBox-Modells in einem Kernkalkül. Das Kalkül ist als typsicher bewiesen und weitere Eigenschaften sind formal behandelt. Die dynamische Semantik des Kalküls ist in dem Rewriting-Logik-Framework Maude implementiert. Eine Java-Erweiterung namens JCoBox zeigt wie das CoBox-Modell in der Praxis umgesetzt werden kann. JCoBox kann sowohl durch einen Kompiler als auch durch Bytecode-Rewriting in standard JVM-Bytecode transformiert werden. Die Geschwindigkeit der JCoBox-Implementierung ist vergleichbar mit anderen moder- nen Aktor-Implementierungen für die JVM. Die Praktikabilität des vorgeschlagenen Programmiermodells und der Sprachumsetzung ist evaluiert durch das Design und die Implementierung von mehreren nebenläufigen Anwendungen. Acknowledgments First of all I thank my supervisor Prof. Dr. Arnd Poetzsch-Heffter. Besides the financial aspect of organizing the funding of my research, he had given me much freedom in the choice of my research and gave me constant support and motivation. I also thank Prof. Dr. Einar Broch Johnsen who reviewed this thesis as the second reviewer and Prof. Dr. Reinhard Gotzhein for chairing the doctoral committee. I thank all my past and current colleagues of the Software Technology Group for many joyful days and fruitful discussions. It has always been a pleasure to work in this group. Concerning this thesis, I thank, in particular, Yannick Welsch for greatly supporting me during the last months of the dissertation writing by relieving me of much of the daily project work. In addition, I thank Yannick for a thorough proof reading of this thesis. For further proof reading I thank Ilham Kurnia and Jean-Marie Gaillourdet. I thank all students, who participated in the cobox journey. In particular, I thank Peter Wortmann for his Scala realization of the cobox model. His work sharped my view on the interplay between promises, futures, and transfer objects. In addition, he revealed several bugs in the JCoBox implementation and several ideas from his task scheduler implementation greatly improved the performance of the JCoBox scheduler. I also thank Alexander Worret, who was the first student who used JCoBox for a larger case study. I thank Arda Subasi, who initiated the bytecode rewriting tool for JCoBox and also helped with the performance evaluation. I thank the authors of all the open source software that I used for doing my research, which are far too many to name here. I also thank Handerson Gomes who made the beautiful cover picture available under a free license. I am very thankful to my parents-in-law Larissa and Eduard for taking care of our daughter in the last month before the finishing of this thesis. Without their support, it would have been much more difficult for me to finish the thesis in time. I thank my parents Marion and Eugen for everything they did for me. I thank my daughter Eline Jolie. With her, no day is like the other, and she always reminds me that there are much more important things in life than computer science. Last but not least, I thank my wife Ekaterina, who always believes in me. Contents 1 Introduction1 1.1 Multi-Threaded Object-Oriented Programming Revisited.........2 1.1.1 Objects...................................2 1.1.2 Sequential Programming Model....................3 1.1.3 Thread-Based Concurrency.......................4 1.2 Active Objects...................................6 1.3 Object-Oriented Components..........................7 1.4 Goals, Contributions, and Outline.......................9 1.4.1 Goals....................................9 1.4.2 Contributions...............................9 1.4.3 Outline................................... 10 2 The CoBox Model 13 2.1 Motivating Example............................... 13 2.1.1 Requirements............................... 13 2.1.2 Object-Oriented Design......................... 14 2.1.3 Thread-Based Implementation.................... 15 2.2 Basic Concepts................................... 16 2.2.1 CoBoxes and Objects.......................... 16 2.2.2 Tasks.................................... 17 2.2.3 Asynchronous Communication.................... 19 2.2.4 Designing the Chat Example...................... 20 2.3 Synchronization and Data Exchange..................... 21 2.3.1 Futures..................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    242 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us