ACCU Home page ACCU Conference Page
Search Contact us ACCU at Flickr ACCU at GitHib ACCU at Facebook ACCU at Linked-in ACCU at Twitter Skip Navigation

Search in Book Reviews

The ACCU passes on review copies of computer books to its members for them to review. The result is a large, high quality collection of book reviews by programmers, for programmers. Currently there are 1949 reviews in the database and more every month.
Search is a simple string search in either book title or book author. The full text search is a search of the text of the review.
    View all alphabetically
Title:
Concurrent Programming in Java 2ed
Author:
Doug Lea
ISBN:
0 201 31009 0
Publisher:
Addison-Wesley
Pages:
411
Price:
£30.99
Reviewer:
Ian Bolland
Subject:
java; parallel systems
Appeared in:
12-4
Most treatments of Java multi-threading follow the same lines. They present a small example, often a variant of debit- credit, to show the dangers of letting multiple threads access the same variable at the same time and then go on to recommend synchronised methods as the solution to the problem. Now as far as it goes, this is good advice. However synchronised methods are not always the best solution to concurrency problems. Firstly, synchronisation adds an overhead to method calls and this penalises all clients; even those who do not require thread safety. Secondly, it opens up the possibility of deadlock and a lot of effort may be required to prevent deadlock. Finally, it does not by itself prevent clients from getting erroneous results. For example, consider the following code to process all elements in a Vector vec:

for(int i=0; i
process(vec.elementAt(i));
If other threads are simultaneously modifying
vec
, this loop may process elements twice, may skip elements and may throw an
ArrayIndexOutOfBoundsException
even though all method calls are synchronised.

This book discusses these and many other, problems in depth. It explains the problems, the alternative solutions and the factors that would cause you to prefer one solution to another. It is intended for intermediate to advanced level Java programmers. Naturally it contains a lot of material that is Java-specific, such as synchronised methods and blocks, wait/notify and the Java memory model. However, the author clearly distinguishes between general concurrency issues and Java-specific ones, so the book will be valuable to anyone using concurrency in any environment.

Sample code and production-quality utilities for handling concurrency can be downloaded from the author's web site. Usefully, the author has placed this material in the public domain, so it can be freely reused.

After more than ten years experience in several languages and environments, I thought I knew quite a lot about concurrent programming. After reading this book, I now know a lot more. Highly recommended.