High Performance Java Platform Computing, 1st edition
Authors: Thomas W. Christopher, George K. Thiruvathukal
Venue:  (2000)

From the Book:PREFACE: PrefaceThis is a book about programming high-performance multithreaded applications using the Java language.Multithreading and multiprogramming, long heralded as useful ideas in the computing literature, have been the focus of numerous textbooks on operating systems, parallel and distributed computing, and, most, recently Java. Yet a key question remains unanswered: Why would one really use threads in the first place? Our book attacks this question from the bottom up and the top down. Beginning with the bottom-up discussion, threads have been created with the primary goal of improving performance of software applications. At a low level, a thread is much like a process, but differs from processes in one key respect: resource consumption. This is because threads, unlike processes, share common code and data, thus having a lower cost of creation and context-switching overhead.On the other hand, the low-level focus on threads-the mechanism-has much to do with why threads have not achieved widespread usage in applications. Threads do allow great advances in performance to be made, but not without some up-front program structuring. The fact that all threads share data structures can in many cases lead to poor performance, due to synchronization costs.To answer the question posed earlier, we believe multithreading exists primarily to allow performance gains to be realized, particularly on scalable hardware platforms, such as parallel supercomputers, workstation clusters, and symmetric multiprocessor (SMP) systems. Our book emphasizes programming techniques and packages for high-end computing (often called the "server side"inthe business world). We are concerned with using the power available on multiprocessor computers and computer networks to perform computations rapidly.This book was conceived as a natural follow-up to a successful series of short courses we offered at the Illinois Institute of Technology and elsewhere to working professionals and graduate students alike. Additionally, between us we have approximately two decades of relevant teaching and research experience in the fields of high-performance computing, object-oriented systems, programming languages, and operating systems.Our research in high-performance computing and languages has always focused on facilitating the development of concurrent, parallel, and distributed software, going back as far as 1988, when we first began working together on the Message Driven Computing (MDC) environment. We have developed a number of working programming languages and libraries to support such software development. All of the work we did in the past, however, was done in the C, Icon, and C++ programming languages. For this book, we have reworked many of our ideas into a form more suitable for the practicing software engineer, while fully exploiting the power of a true object language such as Java.With its built-in support for concurrency via a monitorlike abstraction, Java makes concurrent programming easier for programmers than languages such as C and C++. We will discuss how monitors are adequate for solving many problems in concurrency, particularly the so-called classical synchronization problems, which have been well documented in operating-systems textbooks. As more complex libraries and software systems are developed, the evidence gathered supports the proposition that monitors, much like other low-level mechanisms for synchronization, break down. Monitors, despite being a higher-level mechanism for supporting concurrency, present the same problems as found in "less sophisticated" environments such as C and C++ (where low-level threads libraries, such as pthreads and Win32 threads, are used). We refer in the text to these problems (race conditions and deadlocks) as enemies. We present stategies for dealing with these enemies and a number of higher-level frameworks that enable the programmer to worry less often about them.Java is one of the great programming languages of our time. Like many of the great programming languages, a company was behind its development, adoption, and popularity. The sensational marketing blitz was enough to make many of us think that all of the work on languages was now complete, so we could start packing our bags and look for other work. Now that the dust has settled, it is clear that Java does occupy an important space in the marketplace; however, there is a great deal of potential for exploring other programming languages and techniques. The environments in which Java is being considered will require at least a subset of the ideas presented in this book: network appliances, server-side computing, workstation clustering, and parallel systems, to name a few. In this book, our aim is to give the reader some insight into what Java does and does not provide, in terms of support for concurrency. What Java does not provide, we do provide with a working library of Java code that allows the programmer to "operate at a higher-level" (to borrow a phrase from IBM marketing from the OS/2 days).This book, like all books, does not exist in a vacuum. There are a number of competing books, some of which are appearing in new editions during the next year. We believe our book will be the first of its kind in terms of multithreading and its application to real-world programming. It also provides the following benefits and features: It presents a human-understandable explanation of multithreading, its implementation, and how it works in Java. It helps the programmer to understand the very real problems encountered in concurrent systems, focused on race conditions, deadlock, and problems encountered when introducing parallelism and distribution. This particular aspect of our book brings to life the chapters on concurrency presented in "abstract" OS textbooks, wherein working code examples are seldom, if ever, provided. It helps the programmer to understand the classic synchronization problems, which have suddenly been placed in the spotlight as more and more code is (incorrectly) being written to exploit concurrency. It introduces high-level approaches to shared- and distributed-memory multithreading. This section will be of great interest to those who want to develop multithreaded applications but prefer to work at a higher level. It shows how to extend the threads concept to the network. It shows how to extend the threads model beyond the single Java Virtual Machine (JVM) to a network of JVMs.We hope you enjoy this book. It has been written to address the needs of a broad audience. There is introductory, intermediate, and advanced material. The book is designed to be progressive and can be used either as a reference or as a companion to a variety of courses. Exercises are provided at the end of each chapter to reinforce the principles. Speaking of CodeCode for the Tools of Computing thread package is available through our company Web site at ...