Hi Vad,
I have read a little of Paul Hyde�s
Java Thread Programming and a little of Scott Oak�s Java Threads. Both books offer a lot of helpful insights into thread programming.
I like Hyde�s book. The writing is clear. There are many examples that are sort of like experiments to demonstrate what is happening. There are nice graphs and tables to show what is happening in time.
But I stopped reading it because I was did not completely trust it. I have interlinear notes and question marks here and there.
Hyde says a thread that invokes wait() �sleeps�. Doug Lea says the thread is added to the wait set of the object. Doug Lea says the thread blocks.
Hyde says the thread releases the object-level lock. �object-level�?
When I tried his examples on �volatile�, they did not work for me, although I don�t remember the details.
On yield(), Hyde says a thread can voluntarily give up its turn early. The scheduler will swap it off the processor and allow another thread to run. Doug Lea say yield() is a purely heuristic hint advising the JVM that if there are other runnable threads, the scheduler should run one or more of these threads rather than the current thread. The JVM may interpret this hint any way it likes.
Hyde says �When the lock is released, all the threads waiting for it compete for exclusive access. Only one will be successful, and the other threads will go back into the blocked state waiting for the lock to be released again.� (page 132) �go back�? Or is only one thread unblocked?
I decided it was safer for me to learn from Gosling - The Java Programming Language and Lea - Concurrent Programming in Java.
To be fair to Paul Hyde, let's say this is my first impression. I need to read the whole book.