At 6:29 AM -0600 6/29/00, Tom Cargill wrote:
>I'm reading Allen Holub's 'Taming Java Threads'
>presentation from the recent JavaOne:
>On pages 17 and 18 he presents 7 "Rules to Live By."
>The spirit is right, but I question some of the details.
>The 4th rule (top of p. 18) is too strong, because it
>requires that both threads sync on the same lock.
>Is there expert concensus on the validity of these rules?
I believe that rule is correct and necessary.
I have yet to find any compelling and correct synchronization idioms
that not involving synchronizing on the same monitor. Most attempts
to do so wrong, in either obvious or subtle ways. If you can come up
with such a compelling example, I would be very interested in looking
More importantly, I am proposing changes to the Java Memory Model
that codify this rule into the spec. This change will allow a number
of compiler optimizations, such as the complete elimination on locks
on thread local objects.
So if you have compelling examples of how you would want to
communicate between threads by synchronizing on different monitors,
they should be discussed ASAP.
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:26 EDT