Concurrent Programming in Java
, second edition, surveys a wide field of research in parallelism and concurrency and shows how to do more with multithreading in Java with dozens of patterns and design tips. Written for the advanced Java developer, this book offers a comprehensive tour of leading-edge thinking about parallel coding processes.
Within the dozens of techniques and tips offered here, this book accomplishes at least two goals. First, it shows how concurrency is implemented by default within Java, with material on how built-in features (like the synchronized keyword and its memory model) can be expected to perform when dealing with multiple threads. Naturally, the author also covers Java threads themselves (including priorities, scheduling and the like).
Next, much of this book looks at ways to improve performance of concurrent code beyond the simple default strategies. After defining criteria for measuring concurrent code (such as safety and "liveness", a measure of running live threads effectively), the author presents dozens of techniques for letting threads work together safely. For the working Java programmer, coverage of patterns that have been implemented in downloadable java.concurrency package will be the most immediately useful. (Within this nearly encyclopaedic survey, short code snippets are used for every pattern and concept.) Though theoretically written at times, this book offers plenty of ideas and sample code to get you started thinking of ways to improve multithreaded code.
Impressively comprehensive, Concurrent Programming in Java offers a veritable bible of techniques for doing two things at once with threads in Java. It's a worthwhile guide to the state-of-the-art strategies for improving the performance of your Java threads. --Richard Dragan, Amazon.com
Topics covered: Threads and concurrency in Java, design considerations: safety, liveness and performance, Before/After Patterns, layering, adapters, immutability and synchronisation, deadlock, resource ordering, the Java Memory Model and concurrency, using the java.concurrency package, confinement, refactoring for concurrency, mutexes, read-write locks, recovering from failure, notifications, semaphores, latches, exchanges, transactions, one-way messages, worker threads, polling and event-driven I/O, parallelism techniques: fork/join, computation trees and barriers, Communicating Sequential Processes (CSP).
From the Back Cover
In this second edition, you will find thoroughly updated coverage of the Javao 2 platform and new or expanded coverage of:
- Memory model
- Portable parallel programming
- Utility classes for concurrency control
The Java platform provides a broad and powerful set of APIs, tools, and technologies. One of its most powerful capabilities is the built-in support for threads. This makes concurrent programming an attractive yet challenging option for programmers using the Java programming language.
This book shows readers how to use the Java platform's threading model more precisely by helping them to understand the patterns and tradeoffs associated with concurrent programming.
You will learn how to initiate, control, and coordinate concurrent activities using the class java.lang.Thread, the keywords synchronized and volatile, and the methods wait, notify, and notifyAll. In addition, you will find detailed coverage of all aspects of concurrent programming, including such topics as confinement and synchronization, deadlocks and conflicts, state-dependent action control, asynchronous message passing and control flow, coordinated interaction, and structuring web-based and computational services.
The book targets intermediate to advanced programmers interested in mastering the complexities of concurrent programming. Taking a design pattern approach, the book offers standard design techniques for creating and implementing components that solve common concurrent programming challenges. The numerous code examples throughout help clarify the subtleties of the concurrent programming concepts discussed.