[concurrency-interest] @Contended (JEP-142)

Kasper Nielsen kasperni at gmail.com
Tue Nov 27 13:46:25 EST 2012


Without having read Alekseys previous post to hotspot-dev I would have had
a hard time figuring how the group stuff would work.
While the layout might not be identical on platforms with different
cache-line sizes. I think the examples might be worth including in the

I'm fine with sun.misc. But wouldn't it make sense to introduce a vm
package (for example, java.lang.vm) which contains vm/cpu integration
I'm specially thinking about things that probably inevitable will come at
some point: NUMA-aware information, control of object layout, cpu
information, gc integration.
The package would basically be _expert_ level only. But having having stuff
like that in one standard package people/organizations could easily use
simple tools to make sure rogue developers weren't using anything from the

It probably already is, but I'm just making sure
Instrumentation#getObjectSize() returns the correct number.

I know it is probably out of scope for Java 8 but some tools (without
requiring an agent class) for calculating the object size is missing. I lot
of projects goes through a lot of trouble to calculate the size. See for
example http://www.codespot.net/blog/2012/01/measuring-java-object-sizes/or
just google 'calculate java object size'. These alternative methods
only going to be more broken after introducing @Contended, especially the
reflection based once.

Perhaps adding the method #getObjectSize() to sun.misc.Unsafe for now would


On Tue, Nov 27, 2012 at 6:40 PM, Doug Lea <dl at cs.oswego.edu> wrote:

> Aleksey has been making progress on a hotspot implementation of
> the @Contended annotation. While this progresses, we'd also
> like continued feedback about the java-level information, guidance,
> examples, etc.
> As a compromise that helps avoid controversy about its status
> and specs, the @Contended annotation itself will probably be placed
> in sun.misc, not java.util.concurrent.*. A staging version of
> Contended.java is in our CVS though, with javadoc at:
> http://gee.cs.oswego.edu/dl/**jsr166/src/dl/sun/misc/sun/**
> misc/Contended.html<http://gee.cs.oswego.edu/dl/jsr166/src/dl/sun/misc/sun/misc/Contended.html>
> Any comments and suggestions will be welcome.
> -Doug
> ______________________________**_________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.**oswego.edu <Concurrency-interest at cs.oswego.edu>
> http://cs.oswego.edu/mailman/**listinfo/concurrency-interest<http://cs.oswego.edu/mailman/listinfo/concurrency-interest>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20121127/2d0f34ed/attachment.html>

More information about the Concurrency-interest mailing list