[concurrency-interest] padding in Exchanger

Doug Lea dl at cs.oswego.edu
Tue Jan 17 14:11:26 EST 2012


Two footnotes:

1. Everyone using OpenJDK7+ / OracleJDK7+ on a multisocket x86
(Intel or AMD, also usually Sparcs) should always use the switch
   -XX:+UseCondCardMark
unless using -XX:+UseG1GC (that also includes a form of it.)
Dave Dice's blog from last year explains why in more detail:
   http://blogs.oracle.com/dave/entry/false_sharing_induced_by_card
In short, the marking done on reference writes can itself induce
serious contention problems, and no reasonable amount of padding helps,
since each byte of the cardmark table can stand for 512 addresses,
and they are all held side by side on the same cacheline.

On 01/17/12 12:22, Nathan Reynolds wrote:
> It would be nice if the processor could effectively tell the JVM that false
> sharing is happening. It would be nice if the JVM could respond by moving
> objects within the heap

While I'm skeptical of this happening any time soon, it is worth noting
that this is what Striped64 and new Exchanger do in the case
of CAS contention -- they move thread-local indices to less contended
spots. We still have to waste a fair amount of space to do this though
since we don't have feedback on plain memory contention; just CAS
contention.

-Doug



More information about the Concurrency-interest mailing list