Preface - Systems Programming: Designing and Developing Distributed Applications, FIRST EDITION (2016)

Systems Programming: Designing and Developing Distributed Applications, FIRST EDITION (2016)

Preface

This book provides a comprehensive introduction to designing and developing distributed applications. The main emphasis is on the communication aspects of multicomponent systems, and the ways in which the design of such systems is impacted by, and impacts on, the behavior of the underlying operating systems, networks, and protocols.

The backdrop for this book is the increasing dependence of business, and society in general, on distributed systems and applications. There is an accompanying increasing need for well-trained engineers who can deliver high quality solutions. This requires strong design skills and best practice implementation techniques as well as a big picture view in which the engineer appreciates the way in which applications will use the resources of the system and be impacted by the configuration and behavior of the host system as a whole.

An integrated approach is taken, which cuts across several traditional computer science disciplines including operating systems, networking, distributed systems, and programming, and places the required background and theory into application and systems contexts with a variety of worked examples. The book is multidimensional; it has a problem-solving style and achieves a balance between theoretical underpinning and practitioner focus through development of application use cases of distributed applications.

Through embedded practical activities, the reader actually participates in the content, performing experiments and running simulations as they go. During these activities, dynamic aspects of systems are presented in animated and dynamic ways which convey far more information, and make complex aspects of systems accessible. Most of the accompanying experiments and simulations are user-configurable to support what-if investigation and give the reader an opportunity to gain an in-depth understanding. Practical programming challenges cover a wide range of aspects of systems. Several of these involve building full working distributed applications; these are made accessible through the provision of well-documented sample source code and clear guided tasks to add functionality and build systems by extending the sample code.

The Origin and Purpose of This Book

Designing and developing distributed applications is a hybrid topic in computer science, fundamentally based on concepts and mechanisms which are drawn from several of the traditional core subject areas which include networking, operating systems, distributed systems (theoretical, rather than developmental), and software engineering. The vast majority of high quality texts currently available focus on one of these subject areas with clear traditionally established boundaries in their scope. The majority of these books are primarily theoretical in style and approach.

At the outset of writing this book, I had been teaching a practical-oriented course in the area of distributed applications for many years and was very aware of the lack of a single book that comprehensively covered the subject matter of designing and developing distributed applications, with a strong practical emphasis. In effect, what I wanted was a standalone guide that would serve as a primary text for my own course and for others like it. I also wanted a book that would be accessible to my students, who are a diverse group with different levels of experience and confidence. I wanted, with a single book, to encourage those who are just starting out in software engineering, while equally satisfying the needs of more experienced learners who require more advanced challenges. My course already had a theory-meets-practice emphasis which had worked well for 13 years and was well received by students. On several occasions, when discussing the lack of availability of a suitable course text book, students had suggested I write one myself based directly on the course.

This book fills a clearly identified gap in provision. It provides an integrative text that relates the various underlying concepts together in a self-contained way so that a reader can appreciate the big picture view across systems, while also understanding the key underpinning theory and being able to explore with supported practical activities, all from one self-contained source. As such, the book is differentiated from other mainstream texts which tend to map onto one of the traditional subject areas and also tend to have a more theoretical basis.

The book has been designed to support courses which teach distributed applications design with a theory-meets-practice emphasis. The main focus is on application development and the supporting knowledge necessary to ensure high quality outcomes in this regard, and has been organized so as to naturally bridge across several areas of computer science. As such, it does not attempt to develop as much breadth in those areas as a traditionally organized text (for example, just focusing on networking, or operating systems) would be expected to do. Rather, it provides the very important integration across these disciplines. The primary design is focused on providing accessible example-based coverage of key aspects of distributed systems and applications, with detailed discussion supported by case studies, interactive teaching and learning tools, and practical activities. A main goal was to facilitate readers to understand practical examples of socket-based applications and to start to develop their own applications as a guided parallel track to the reading of the book.

The theoretical aspects of the book and the majority of mechanistic aspects covered are transferrable across languages, but there are implementation aspects which have language-dependent interpretation. Sample code is therefore provided in three popular programming languages to maximize accessibility: C++, Java, and C#.

The supplemental resources code base is extensive, including sample code for the various in-text examples, starting points, and sample solutions for the end-of-chapter programming tasks, and full source code for all three of the case studies.

The supplemental resources also include special editions of the author’s established Workbenches suite of teaching and learning tools. These are used in some of the in-text activities and can also be used on a broader basis of self-guided or tutor-guided exploration of topics, or can be used to bring the subject matter to life in lectures or laboratory settings. The concept of the Workbenches was inspired by the need to represent dynamic aspects of systems in realistic and accessible ways. Any tutor who has attempted to teach scheduling (as one example of the very many dynamic aspects covered) with a series of static diagrams will appreciate the limitations of the approach in terms of the difficulty to convey the true richness of the behavior that can be exhibited. The Workbenches were specifically designed to overcome these limitations when teaching dynamic or complex aspects of systems. The user-configured practical experiments and user-configured simulations cover a wide range of topics in networking, distributed systems, and operating systems. The chapter texts link to these activities and provide guidance to the reader to map the practical learning to the underpinning theoretical concepts.

The style of the book, with its strong emphasis on guided practical exploration of the core theory, makes it suitable as a self-study guide as well as a course companion text.

The Intended Audience

The book has been designed to have a very wide appeal. The target audience includes

• Teachers of distributed systems who require a self-contained course text with in-built practical activities, programming exercises, and case studies which they can use as the basis of an interesting and inspiring course.

• Students studying application development and requiring a book which links together the many different facets of distributed systems, operating systems, and networking, with numerous clearly explained practical examples and a rich repository of sample code.

• Experienced programmers who are new to designing and developing distributed applications and/or socket programming, or perhaps need a quick-start resource to get a distributed application project off the ground.

• Trainee programmers learning any of C++, Java, or C# and requiring the additional challenge of writing network applications with sockets.

• Sockets-level programmers familiar with one of the languages supported by the book {C++, Java, C#} and requiring an example-based resource to facilitate cross-training to one of the other languages.

• Students studying other areas of computer science and requiring a basic grounding in distributed systems in the form of a self-study guide with a practical emphasis.

The Organization of the Book

The book has a core section of four chapters which look at the background concepts, technical requirements, challenges presented, as well as the techniques and supporting mechanisms necessary to build distributed applications. Four specific viewpoints have been chosen so as to divide the material into related categories which are significant from a design and operational perspective. This approach enables a structured and detailed examination of the underlying concepts and mechanisms of systems, which cuts across the boundaries of the traditional teaching subjects.

The following Chapter 6 is set at the higher level of distributed systems themselves. This chapter does the important job of integrating the ideas, concepts, and mechanisms discussed in the earlier core chapters into the context of entire systems, and identifies the services needed to ensure those systems are high quality in terms of their functional and nonfunctional requirements.

All of the chapters have a practical emphasis, with in-built experiments and practical exploration activities and there is a case study that runs through all of the core chapters, integrating and cross-linking them. However, to address the wide scope of architectures, structures, behaviours, and operating contexts of distributed applications, a final chapter provides two further, fully operational and clearly documented case studies accompanied by full code.

The Introduction chapter motivates the book and the integrative systems approach that has been taken. It provides a brief historical perspective on the rise of distributed computing and its significance in a modern context. It provides a short foundation of some key topics which are covered in depth later in the book, but are necessary for the reader to have a basic appreciation at the outset. This includes the general characteristics of distributed systems; the main benefits of distributed systems; key challenges that must be overcome when building distributed applications; metrics for measuring the quality and performance of distributed systems; and an introduction to the main forms of transparency. This chapter also introduces the three case studies, the supplementary material available at the book’s companion Web site, the in-text practical activities, and the Workbenches suite of interactive teaching and learning tools.

The Process view chapter examines the ways in which processes are managed and how this influences communications at the low level. It deals with aspects such as process scheduling and blocking, message buffering and delivery, the use of ports and sockets, and the mechanism of process binding to a port which thus enables the operating system to manage communications at the computer level on behalf of its local processes. This chapter also deals with concepts of multiprocessing environments, threads, and operating system resources such as timers.

The Communication view chapter examines the ways networks and communication protocols operate and how the functionalities and behavior of these impact on the design and behavior of applications. This viewpoint is concerned with topics which include communication mechanisms and the different modes of communication, e.g., unicast, multicast, and broadcast, and the way such choices can impact on the behavior, performance, and scalability of applications. The functionality and features of the TCP and UDP transport-layer protocols are described, and compared in terms of performance, latency, and overheads. Low-level details of communication are examined from a developer viewpoint, including the role and operation of the socket API primitives. The remote procedure call and remote method invocation higher-level communication mechanisms are also examined.

The Resource view chapter examines the nature of the resources of computer systems and how they are used in facilitating communication within distributed applications. Physical resources of interest are processing capacity, network communication bandwidth, and memory. The discussion focuses on the need to be efficient with the use of these finite resources which directly impact on the performance and scalability of applications and the system itself. Memory is also discussed in the context of buffers for the assembly, sending, and receiving of messages.

The Architecture view chapter examines the structures of distributed systems and applications. The main focus is on the various models for dividing the logic of an application into several functional components and the ways in which these components interconnect and interact. The chapter also considers the ways in which the components of systems are mapped onto the underlying resources of the system and the additional functional requirements that arise from such mapping, for example, the need for flexible run-time configuration. The various architectural models are discussed in terms of their impact on key nonfunctional quality measures such as scalability, robustness, efficiency, and transparency.

The Distributed Systems chapter follows the four core viewpoint chapters. Distributed systems form a backdrop for these chapters as they each deal with a specific set of supporting theoretical aspects, concepts, and mechanisms. This chapter is set at a level higher and focuses on the distributed systems themselves, their key features and functional requirements, and the specific challenges associated with their design and development. The distributed systems chapter thereby puts the content of the core chapters into the wider systems perspective and discusses issues that arise from the distribution itself, as well as techniques to address these issues. The provision of transparency is key to achieving quality in distributed applications. For this reason, transparency is a theme that runs through all the chapters, in relation to the various topics covered, and is also a main focal aspect of the discussion of the case studies. To further reinforce the importance of transparency, it is covered as a subject in its own right, in depth in this chapter. Ten important forms of transparency are defined and explored in terms of their significance and the way in which they impact on systems and applications. Techniques to facilitate the provision of these forms of transparency are explained. This chapter also describes common services, middleware, and technologies that support interoperability in heterogeneous environments.

The final chapter “Case studies—putting it all together” relates together the content of the previous chapters in the form of a pair of detailed distributed application case studies which are used as vehicles to illustrate many of the various issues, challenges, techniques, and mechanisms discussed earlier. The goal is to provide an integrative aspect, in which applications are examined through their entire life cycle. This chapter has a problem-solving approach and is based around provided working applications, their source code, and detailed documentation. The presentation of these applications makes and reinforces links between theory and practice, making references to earlier chapters as necessary.

In-Text Activities

A series of practical activities are embedded throughout the text of chapters 26 to reinforce key concepts through experimentation. Each activity is based on a specific concept or mechanism which the activity places into a systems or application context.

How to Use the Book

The book has been designed to flexibly support a wide variety of users with different requirements. Suggested uses include:

As an essential course text. This was the primary motivation for writing the book. The book has been based on a successful course on designing and building distributed applications. There is in-depth coverage of the central theme of distributed applications, supported by detailed practical activities, working examples, case studies, end-of-chapter questions, and programming challenges with solutions. The book also includes a wide range of foundational and supporting technical material including concepts, issues, mechanisms, and strategies relating to aspects of systems that need to be understood.

Due to a combination of the cross-cutting integrative approach taken, and the extensive resource base provided, the book provides an ideal course guide; tutors can flexibly structure courses around the book depending on the technical depth that they wish to achieve and the experience level of their students. The source code for the example programs are provided at the book’s resources Web site, in three languages: C++, Java, and C#.

The Workbench-based activities can be used as demonstrators during lectures, or as guided exercises in either the classroom or as directed self-study. These can be used to illustrate dynamic behavior through inter alia simulations of scheduling, thread priority, or deadlock (which are all notoriously difficult to convey to students when only static diagram representations are used). Live simulations can be used in exciting ways by pausing the simulation and asking the audience what they think will happen next, or by running the simulations with different settings to show how certain configuration affects behavior.

The network experiments can be used to demonstrate setting up of communications between processes and sending messages across. This can be used to explore the use of the socket primitives, aspects of performance such as blocking and buffering, and also the behavior of the transport protocols TCP and UDP. For example, you can explore the TCP bind-listen-connect-accept sequence necessary to set up a connection, dynamically with real processes, in a lecture setting.

You can also use the Workbench activities to set a wide variety of student laboratory exercises or homework, for example, to evaluate efficiency in communication, scenarios where communication deadlock may occur, or perhaps to use the detailed statistics generated to compare scheduling algorithms in terms of efficiency, fairness, or throughput.

The Distributed Systems Workbench will enable you to (for example) set up an election algorithm experiment that runs on all of the computers in a laboratory. Students can examine scenarios such as terminating the current master process and predicting the next behavior. You can start multiple master process instances and see how the algorithm resolves the situation. The provided logger application will capture the run-time sequence of process state changes for subsequent analysis. Another example is to explore the client–server game application and to ask students to attempt to reverse engineer the message sequence that occurs based on observed behavior; challenges such as this are very good to encourage deeper enquiry.

The use cases are all fully working and can be translated into learning and evaluation exercises, or used as a basis on which to build larger projects.

The end-of-chapter programming exercises can be used as assessed activities or tutorial activities. You can use them as provided, or elaborate on the challenge depending on the level of experience of your students.

As a self-teach guide. The book is an ideal guide for independent study; a large amount of technical documentation is provided to accompany the practical aspects of the content which enables you to use the book in a self-teach manner, and be able to check your progress as you go along against the sample solutions (for the programming challenges), explanations of expected outcomes (for the in-text activities), and answers to end-of-chapter questions. The experiments and simulations provided by the Workbenches are user-configurable and repeatable so that you can work at your own pace and explore as deep as you need. One of the main original motivators for the development of the Workbenches was the realization that we all learn at different rates, and what one person gets immediately others may struggle with at first. Therefore, the Workbenches support personalized/progressive learning.

By providing sample application code in three popular languages, the book also serves as a sort of Rosetta stone for the use of the socket API and the transport layer protocols (TCP and UDP). Once you understand the implementation in one of the languages, you can use the examples to relate across the different languages. This is particularly helpful where, for example, you are developing a system that has some components developed in one language (for example, the server side could be C++) and some components developed in another language (for example, the client side could be developed in C#). The final case study in Chapter 7 purposefully emphasizes this aspect of heterogeneity and interoperability. The use cases are a powerful study resource for self-learning target setting and reflection, enabling you to master each of them one by one over whatever time line suits your needs and initial experience.

As a secondary text. The book has an integrative cross-cutting theme which sits across the traditional subject areas of networking, operating systems, programming, and distributed systems theory. The book, with its clear explanations and strong practical emphasis, is an ideal supplemental text to spice up courses where the primary focus is one of (networking, application development, or operating systems), with the addition of the various activities and programming exercises. It has a quite different style to the more traditional tightly focused and often primarily theoretical-oriented texts and would be good to use side by side with other specialized texts to give students a variety of information sources and to help fill some of the gaps where the taught subject matter overlaps other subject areas (an aspect this book excels in).

The Workbench-based activities are all suitable for standalone piecemeal use. For example, you may choose to only use a subset of the activities of the Operating Systems Workbench (or one of the others) to bring to life some specific aspects of the course content that students struggle with, or simply to break up a long sequence of presentation slides with a live experiment or simulation.

As a reference text with practical examples. The book covers a wide range of topics within the subject areas of distributed systems, networking, programming, and operating systems. The book is distinguished from mainstream alternatives by its extensive range of practical examples and source code resources. It therefore serves as a reference guide with a twist. For a significant proportion of the topics, you will find related guided practical activities or programming challenges with solutions or contextualization in the form of one or more of the use cases.

The Support Materials

The book is supplied with supplementary materials provided via a companion Web site. The URL is http://booksite.elsevier.com/9780128007297.

The materials are organized on the Web site in a way which maps onto the various chapters in the book. There are several types of resources which include:

Sample program code. Sample code is provided for the in-text activities and examples where relevant, the use-case applications, and sample solutions for the programming exercises. The sample code can be used in several ways:

• In most cases, complete application source code is provided. This enables readers to study the entire application logic and to relate it to the explanation in the text. There are cases where the text provides brief code snippets to explain a key point; the reader can then examine the full application code to put the snippet into perspective with the application logic. Much of the sample code is provided in three languages: C++, Java, C#.

• The sample application code can be used as a starting point on which to develop solutions to the end-of-chapter resources; guidance as to which is the most appropriate resource to use is given in such cases.

• There are also some specific sample solutions to the end of chapter programming exercises, in cases where the solution is not already exemplified elsewhere in the resources.

Executable files. Many of the applications are also provided in executable form. This enables readers to run applications and study their behavior without having to first compile them. This is particularly important when following the in-text activities and examples to minimize interruption when switching between reading and the practical work.

The Workbenches teaching and learning tools. The book is accompanied by a suite of sophisticated interactive teaching and learning applications (called Workbenches) that the author has developed over a period of 13 years to promote student-centred and flexible approaches to teaching and learning, and to enable students to work remotely, interactively, and at their own pace. The Networking Workbench, Operating Systems Workbench, and Distributed Systems Workbench provide combinations of configurable simulations, emulations, and implementations to facilitate experimentation with many of the underlying concepts of systems. The Workbenches have been tried and tested with many cohorts of students and are used as complementary support to several courses by several lecturers at present. Specific technical content in the book is linked to particular exercises and experiments which can be carried out using the Workbench software tools. For example, there are specific experiments in the Networking Workbench that deal with addressing, buffering, blocking versus nonblocking socket IO modes, and the operation of the TCP and UDP protocols.