[concurrency-interest] regarding Striped64 class-
dl at cs.oswego.edu
Tue Sep 6 07:00:16 EDT 2011
On 09/06/11 04:50, Yechiel Feffer wrote:
> Why are the padding vars of the Cell declared as volatile too ? Sure-they are
> not touched so no cost. Is it related to Jvm reordering ?
Until some standardized form of advice appears (a new "@Contended"
annotation is the best proposal I've heard), the most effective
way to do padding is entirely empirical. The way it is done
in Striped64.Cell works well for volatile longs on current
versions of OpenJDK/hotspot and IBM J9, and might not generalize.
However, VMs are known to sometimes reorder fields based on
types and qualifiers, so using the exact same types and qualifiers
is a good rule of thumb.
BTW, people seeing a lot of cache contention problems might
also try the hotspot switch -XX:+UseCondCardMark.
More information about the Concurrency-interest