[concurrency-interest] @Contended (JEP-142)
nathan.reynolds at oracle.com
Thu Nov 29 18:19:52 EST 2012
> maybe some day could we have the JVM figure out and create padding
Intel and Oracle (and probably a lot of others) have kicked this idea
around. It is a much longer term project. @Contended is the faster
For starters, it is sometimes very difficult to detect false sharing.
The processor counters don't clearly say "There is false sharing at this
address!" In a specific case, they said the reorder buffer is full and
is causing stalls due to a return instruction. That took us a while to
figure out it was false sharing.
Architect | 602.333.9091
Oracle PSR Engineering <http://psr.us.oracle.com/> | Server Technology
On 11/29/2012 3:42 PM, Jeff Hain wrote:
> >IMHO, sun.misc.Contended is the right place for this one,
> >as it will hopefully discourage people from using it,
> >unless they really know what they are doing.
> It will also discourage people from using it, even though
> they would know what they are doing, if they want to make
> efficient AND portable libraries.
> To remain portable I'll stick to hand-made padding until
> @Contented or equivalent makes it to non-JVMese Java.
> That said, I understand that it might not be a good idea
> to promote such a low-level feature into the language
> (maybe some day could we have the JVM figure out and create
> padding dynamically?).
> >Next you find programmers making all their fields "Contended",
> >because they read on some blog that it makes things faster.
> >Then instead of your object using only 32 bytes, it gets
> >bloated to 512 bytes.
> Programmers already have access to much more dangerous features
> such as System.exit(...), while loops, new (!!!), etc.
> If people have trouble understanding that it causes memory padding,
> maybe it could be renamed into @CacheLinePadded.
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest