REVIEW - Java Concurrency in Practice

Title:

Java Concurrency in Practice

Author:

Brian Goetz, Tim Peierls

ISBN:

0321349601

Publisher:

Pearson Education (2006)

Pages:

403pp

Reviewer:

Paul Thomas

Reviewed:

April 2007

Rating:

★★★★★

There are two ways of looking at this book: one is as a guide to the java.util.concurreny.* packages introduced with Java 1.5, the other is as a treatise on modern multi-threaded programming in Java. The two go hand in hand of course: the concurrency package was added as a result of JSR-133 - the Java Community Process work on threading and memory model.

If you want to get fully up to date with multithreading in Java, then you really should take the time to read this book. It covers just about every aspect of threading from the general issues of concurrency to the specifics of implementing custom synchronisers using the AbstractQueuedSynchroniser base class. In fact, I'd go further and say that if you are interested in concurrency at all, regardless of the language you use, then you should read this book. It's more than just teaching you how to use some Java classes. Topics such as composability of thread safe classes can apply to all modern program design. And I don't think I've come across a book that deals with testing multithreaded classes before.

It wouldn't work as a reference book, but mine will be sitting on the desk for some time. It needs to be read and re-read. If you want to flick through looking for a specific example, the examples of broken code are clearly labelled with a sick-face motif. Just a little detail, but one that could make all the difference!

As well as covering the technical details of threading, locking and memory models, the book is filled with snippets of information about the implementation of JVMs. One example is the discussion of the relative merits of explicit locks vs. implicit locking via 'synchronized'. Not only are we shown profiling data to show how the techniques scale, but we are told how work on Java 6 has drastically changed the situation for the better. The authors don't just state that atomic variables are lighter than locks - they explain in great detail why it might be so. This sort of detail makes the difference between knowing a subject and really understanding.


Book cover image courtesy of Open Library.