[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: java.util.Hashtable.size()/isEmpty()
From: |
Jeff Sturm |
Subject: |
Re: java.util.Hashtable.size()/isEmpty() |
Date: |
Fri, 15 Feb 2002 11:24:02 -0500 (EST) |
On Fri, 15 Feb 2002, Etienne M. Gagnon wrote:
> Have you heard of "thin locks" and other VM level optimizations that reduces
> "significantly" the cost of locks?
Even the ideal lock still carries a large cost. The CPU will probably
stall, flush its store buffer, reload values from memory, etc.
There's no escaping that. (However I'm not sure if this is true when
reentering a lock already held by the current thread.)
> The "synchronize" will force the "current processor" to update its data
> cache.
Most modern multiprocessors use hardware cache coherency (though the Java
memory model doesn't require this, and relying on it isn't a good idea).
More importantly, synchronization forces ordering of loads and stores.
My impression is that hardware cache coherency is a bad idea because it
gives programmers a false sense of security and may even limit the
scalability of SMP hardware due to the extra bus traffic required. (I
wonder if anyone's tried Java on a NUMA architecture?)
> Mutiprocessors + threads => difficult programming.
Most definitely.
Jeff
- java.util.Hashtable.size()/isEmpty(), Sascha Brawer, 2002/02/15
- Re: java.util.Hashtable.size()/isEmpty(), Dalibor Topic, 2002/02/15
- Re: java.util.Hashtable.size()/isEmpty(), Artur Biesiadowski, 2002/02/15
- Re: java.util.Hashtable.size()/isEmpty(), Etienne M. Gagnon, 2002/02/15
- Re: java.util.Hashtable.size()/isEmpty(), Artur Biesiadowski, 2002/02/15
- Re: java.util.Hashtable.size()/isEmpty(), Etienne M. Gagnon, 2002/02/15
- Re: java.util.Hashtable.size()/isEmpty(), Etienne M. Gagnon, 2002/02/15
- Re: java.util.Hashtable.size()/isEmpty(), Sascha Brawer, 2002/02/15
- Re: java.util.Hashtable.size()/isEmpty(),
Jeff Sturm <=
- Re: java.util.Hashtable.size()/isEmpty(), Artur Biesiadowski, 2002/02/15
- Re: java.util.Hashtable.size()/isEmpty(), Bryce McKinlay, 2002/02/15
- Re: java.util.Hashtable.size()/isEmpty(), Jeff Sturm, 2002/02/15
- Re: java.util.Hashtable.size()/isEmpty(), Bryce McKinlay, 2002/02/15
- Re: java.util.Hashtable.size()/isEmpty(), Eric Blake, 2002/02/15