Jump to ratings and reviews
Rate this book

Concurrent Programming in Java : Design Principles and Pattern, 2nd Edition

Rate this book
One of Java's most powerful capabilities is its built-in support for concurrent programming, a design technique in which multiple concurrent activities-threads take place inside a single Java program. Thread programming enables developers to design applications that are more responsive to user demands, faster, and more easily controlled. This book offers comprehensive coverage of this vital aspect of the Java language. The book is completely up-to-date with the new thread model that is now incorporated into the most recent version of the Java Virtual Machine. All Java programmers interested in doing concurrent programming must understand these new concepts. The book approaches the topic from a design pattern point of view. It introduces and summarizes Java's concurrency support, shows readers how to initiate, control, and coordinate concurrent activities, and offers numerous recipe-like techniques for designing and implementing Java structures that solve common concurrent programming challenges. Specifically, the book presents important strategies for avoiding the inconsistencies that can crop up in multi-threaded programs, addresses the concept of "liveness"-how to ensure that all threads in use are kept active simultaneously, examines state-dependent action, and demonstrates effective methods for handling user requests in a multi-threaded environment.

432 pages, Paperback

First published November 1, 1996

11 people are currently reading
489 people want to read

About the author

Doug Lea

9 books7 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
61 (40%)
4 stars
64 (42%)
3 stars
19 (12%)
2 stars
4 (2%)
1 star
2 (1%)
Displaying 1 - 15 of 15 reviews
Profile Image for Chad Rhyner.
1 review6 followers
January 7, 2013
In this book, it covers a lot of different concurrent programming constructs. Some of these constructs are commonly known for Computer Scientists (things such as Binary/Counting Semaphores, fork/join, acquire/release constructs, latches.). Going into this book, I thought this would be more of a review of some of my Computer Science studies. I was pleasantly surprised to learn new terms and techniques to handle concurrency issues that I never would have thought of without reading this book. These examples all pleasantly surprised me, such as "Oh yea, I guess that would be useful to do in a situation like when you want to make sure that all systems in a distributed system are shut off."

One thing it was also nice to read is the trade-offs between using solution x versus solution y. In the real world (and in Computer Science, in general), there are constant tradeoffs. The age old example is "use more memory for the algo -or- wait more time for the algo to complete" is a common paradigm that software engineers need to make on a day-to-day basis. It is nice to hear from experience some of the trade-offs that need to be considered when using a technique described in the book.

I would have given this book a 5-star rating if it was not for one thing that continually irked me. As you are reading along, instead of referencing a concept in the book that may have already been mentioned or is going to be mentioned...it always referenced the Section Numbers. It was annoying and tedious to read. A sentence might be like this:

"While technique is used extensively, if you are looking for more flexibility in the framework that you use, refer to Section 2.3.2.3." Instead of giving me some pedantic section number, why don't you just say the section name? Say something like "or you could use techniques described in the Guarded Methods section to achieve the same results is a less complicated way.". The section numbers instead of the section names bugged me enough to remove 1 star from the review. I was thinking about removing 2 stars, but I think that was probably a bit too drastic.
Profile Image for Cristian.
41 reviews
March 16, 2022
One might wonder as I did if this work is still worth reading, given that Java concurrency in Practice (JCIP) is a more recent book, always recommended for concurrency in Java, and also has Doug Lea as one of its authors. And the answer is: very much so. Even though it’s a 1999 book, it is still surprisingly relevant. It shows its age at parts, e.g. in the use of raw types (generics were added in 2004 with Java 5), or when giving examples of SynchronizedInt and similar classes for what we now have AtomicInteger and siblings. But even so, as the book’s subtitle says, the book is about design principles and patterns, and luckily (or maybe obviously) these are timeless. And all this coming from a clear authority on the subject, given that he is the main author of the java.util.concurrent package (JSR 166).

Concurrent Programming in Java (CPJ) provides a mixture of theory and practice, and although the theory is solid (going over the usual topics such as safety and liveness concerns), the practice is what shines in it. The book shows different alternatives to solving problems, with many code samples, and discussions of the trade-offs of each design.

It’s likely that JCIP should be read first, in part so that the reader can more easily distinguish warnings that are no longer true (e.g. that Locks “may entail greater overhead since they are less readily optimized than are uses of built-in synchronization”). Also, because JCIP is more up-to-date. It goes over most of the java.util.concurrent utilities and when to use them, so it has more actionable advice for the average programmer.

CPJ instead relies more heavily on wait/notify patterns which are nowadays mostly discouraged in favor of the java.util.concurrent utilities (which were added later to the language thanks in great part to Doug Lea’s work). But if one needs to use wait and notify/notifyAll, I doubt there is a book with a bigger set of solid examples. Given that the book is previous to JSR 166, rather than going over the java.concurrent.package and how to use its utilities, the book deals more with how one would go about designing and implemeting such utilities, showing implementations of a Semaphore and a Semaphore with fairness guarantees (a FIFOSemaphore), a Lock (called Mutex in the book), etc.

A lot of techniques for designing and refactoring existing classes are also outlined, such as before/after designs, conflict sets, splitting locks, splitting classes, and the Specific Notification pattern, among many others. The book is also full of references, which is very useful for anyone wanting to dig deeper into the literature.
Profile Image for Borys.
110 reviews28 followers
September 4, 2014
Well, it took me a very long time to finish this one :) A couple of months or so. Style of the book is very academic, and I had to re-read some passages many times (also I've got to mention that it is somewhat hard to read this book while riding the subway :)

I never had any problem with cross references, as other reviewer mentions. And I don't think it's not worth a read because it's too old and outdated, I think it's as useful as ever. It explains some basic stuff, it elaborates on Java memory model, on monitors, on how wait and notify really work internally, and also covers large number of design patterns and paradigms (and therefore it will be relevant as long as those patterns are used in practice).

So, my final word is: very useful book to read if you really want to understand how to write good and live and safe concurrent programs.

P.S. I first heard about this book while reading this review: http://steve-yegge.blogspot.com/2008/...
Profile Image for Ruslan Diachenko.
88 reviews3 followers
March 12, 2022
There is little you can get from this book if you have already read Java Concurrency in Practice and Java Threads. I don't think this is a good first book on the subject either. However, even though the book was written decades ago, it contains useful examples, ideas and patters which were eventually introduced and used in the Java concurrent package.
Profile Image for Chris Seltzer.
618 reviews3 followers
June 25, 2023
This is an excellent review of the concepts and ideas of concurrency in Java but I think it's a worthwhile read for every programmer. Partially this is because I think Java is one of the few general purpose languages that handles concurrent programming well.

The content is well written and concise. Would recommend.
Profile Image for Martin Chalupa.
224 reviews5 followers
April 25, 2016
A very good overview of concurrent programming in Java. I was worried that the book might be now obsolete, but most topics are covered in timeless manner. The book goes over basic concurrency constructs in Java such as synchronized, wait, notify. Then it uses them to show useful design pattern. And those pattern are generalised into higher level concurrency utilities. I like that everything is clearly explained. The author provide details which leads to certain design decision. What is useful in what context.
1 review
Read
July 24, 2010
Concurrent Programming in Java(TM): Design Principles and Patterns (3rd Edition)
2 reviews
Read
January 11, 2018
Considered the source for theory and good practices in Java concurrency programming.
Not for the beginning developer.
Displaying 1 - 15 of 15 reviews

Can't find what you're looking for?

Get help and learn more about the design.