Advanced Search
Start Your Free Trial

Overview

Other Readers Also Read...
Java Concurrency in Practice

Java Concurrency in Practice
by Brian Goetz; Tim Peierls; Joshua Bloch; Joseph Bowbeer; David Holmes; Doug Lea

Java Generics and Collections, 1st Edition

Java Generics and Collections, 1st Edition
by Maurice Naftalin; Philip Wadler

Java™ I/O, 2nd Edition

Java™ I/O, 2nd Edition
by Elliotte Rusty Harold

Java NIO

Java NIO
by Ron Hitchens

Top Sellers in this Category

Swing Hacks

Swing Hacks
by Joshua Marinacci; Chris Adamson

Learning Java, 3rd Edition

Learning Java, 3rd Edition
by Patrick Niemeyer; Jonathan Knudsen

Java Threads, 3rd Edition

Java Threads, 3rd Edition
by Scott Oaks; Henry Wong

Eclipse Cookbook

Eclipse Cookbook
by Steve Holzner

Java Swing, 2nd Edition

Java Swing, 2nd Edition
by Marc Loy; Robert Eckstein; Dave Wood; James Elliott; Brian Cole

Threads aren't a new idea: many operating systems and languages support them. But despite widespread support, threads tend to be something that everyone talks about, but few use. Programming with threads has a reputation for being tricky and nonportable. Not so with Java. Java's thread facilities are easy to use, and--like everything else in Java--are completely portable between platforms. And that's a good thing, because it's impossible to write anything but the simplest applet without encountering threads. If you want to work with Java, you have to learn about threads. This new edition shows you how to take full advantage of Java's thread facilities: where to use threads to increase efficiency, how to use them effectively, and how to avoid common mistakes. Java Threads discusses problems like deadlock, race condition, and starvation in detail, helping you to write code without hidden bugs. It brings you up to date with the latest changes in the thread interface for JDK 1.2. The book offers a thorough discussion of the Thread and ThreadGroup classes, the Runnable interface, the language's synchronized operator. It explains thread scheduling ends by developing a CPUSchedule class, showing you how to implement your own scheduling policy. In addition, Java Threads shows you how to extend Java's thread primitives. Other extended examples include classes that implement reader/writer locks, general locks, locks at arbitrary scope, and asynchronous I/O. This edition also adds extensive examples on thread pools, advanced synchronization technique, like condition variables, barriers, and daemon locks. It shows how to work with classes that are not thread safe, and pays special attention to threading issues with Swing. A new chapter shows you how to write parallel code for multiprocessor machines. In short, Java Threads covers everything you need to know about threads, from the simplest animation applet to the most complex applications. If you plan to do any serious work in Java, you will find this book invaluable. Examples available online. Covers Java 2.

Amazon.com® Reader Reviews (Ranked by Helpfulness)

Average Amazon.com® Rating: 3.5 out of 5 rating Based on 41 Ratings

Comprehensive coverage of multithreading and Java 5 inclusions. - 2006-05-08
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
<< Review of the 3rd Edition >>

This book is written for developers who are targeting the second wave of java programs - Intermediate to advanced level programmers will be able to get best value out of this book. Developers who are already familiar with the basics of java may also be able to get some value, but if you are completely new to java, please look elsewhere.

Without any futher ado, i will dive right into the deep end of the pool. This book is partitioned into 4 logical sections, though it is not explicit in the TOC.

1. Important Threading Concepts:
In this section, the author prepares us with the fundamentals of creating and managing a thread, basic synchronization concepts, synchronized keyword, lock mechanism, thread communication using wait-notify and condition-variables, minimal synchronization using volatile keyword and atomic variables, advanced synchronization classes like Barrier, Semaphore, CountdownLatch, etc. Chapters 1 through 6 underwrite this section and this is by-far the best part of the book.

2. Thread Pools/Schedulers:
This section first lectures around how thread scheduling materializes in java and how it is related to the underlying Operating System. Next, you are guided through a tour of Thread Pools and Task Schedulers that will enlighten us with quite a few new classes in java 5. Chapters 9 through 11 cover this section.

3. Threading and other Java APIs:
This section details how the threading API plays with other inbuilt java APIs like Collections, IO and Swing. Chapters 7,8 and 12 cover this section.

4. Misc topics:
Some miscellaneous thread topics like ThreadGroup, Security, Class Loading, Exception Handling and Performance are addressed in this section. Chapters 13, 14, and 15 cover this section.

Though this book wasn't an easy read, i found it extremely encouraging to have ONE comprehensive manual to understand both the threading concepts and the new java 5 inclusions. I recommend this book to anyone who is in the middle of a complex multi-threaded system or wishes to create one.

Lots of experimental data, clear answers - 2007-04-02
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
This book provides answers to questions on threading that have confused me for a long time:
1. Why use a thread pool and why not?
2. How expensive are synchronization, thread creation and concurrent collections?

It clears up a lot of myths and rumors I have heard.

Unsubstantiated irrelevant and inaccurate claims. Avoid. - 2009-12-09
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
This book makes the following claims which as far as I can see are entirely baseless, for the reasons given:

> A Java virtual machine is required to implement a preemptive, priority-based scheduler

The word 'pre-emptive' does not appear in the JLS.

> The Java virtual machine never changes the priority of a thread, even if the thread has been running for a certain period of time

Can't find that anywhere either.

> the contract between the Java virtual machine and the underlying operating system is that the operating system must generally choose to run the Java thread with the highest priority

The 'contract' is between the Java code and the JVM, not the JVM and the O/S.

> That's what we mean when we say that Java implements a priority-based scheduler

Java isn't required to 'implement' a scheduler at all.

> This scheduler is implemented in a preemptive fashion, meaning that when a higher-priority thread comes along, that thread interrupts (preempts) whatever lower-priority thread is running at the time.

This appears nowhere in the JLS.

> The contract with the operating system, however, is not absolute, which means that the operating system can sometimes choose to run a lower-priority thread.

In other words it's +not+ pre-emptive. Make up your mind.

> Java's requirement for a priority-based, preemptive scheduling mechanism ...

Which is nowhere to be found.

> A Java thread can have one of 11 priorities

MIN_PRIORITY is 1, MAX_PRIORITY is 10: that makes 10, not 11.

> In fact, preemption means only that a higher-priority thread runs instead of a lower-priority one

No it doesn't. It means that when a higher-priority thread becomes ready it pre-empts the execution of any lower-priority threads that are currently executing regardless of time-slice etc. This is a feature of real-time systems that Java is +not+ required to implement.

This book cannot be recommended in the presence of these egregious errors. Doug Lea's book as recommended by other reviewers is the one to go for.

Tutorial more than reference - 2009-07-27
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
This book is fine if you are looking to start at page 1 and buy into their ongoing eg program. My gripe is that
the eg program is Swing based. I hate Swing eg's in general. They generally just make the specific point that is being demonstrated more difficult to identify. So, please, all you authors out there, for the love of god don't use Swing eg's unless your writing a book on Swing.
It's the sort of book that makes you work to understand things that you already know.

right book - 2009-05-13
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
after initial issues with sellers that did not reply to 5 emails the book arrived in time and in very good status.

Browse Similar Topics

Top Level Categories:
Programming

Sub-Categories:
Programming > Java
Java > Multithreading
Java > Swing

Some information on this page was provided using data from Amazon.com®. View at Amazon >


About Safari Books Online • Terms of Service • Privacy Policy • Contact Us • Corporate Licenses • Help • Accessibility | See us on FacebookSee us on Linked InSee us on TwitterRSS

Copyright 2010 Safari Books Online. All rights reserved.