[concurrency-interest] DirectByteBuffers and reachabilityFence

Andrew Haley aph at redhat.com
Wed Dec 9 14:03:02 EST 2015


On 12/09/2015 06:52 PM, Vitaly Davidovich wrote:
>>
>> I don't think it'd be measurable.  A global volatile write is pretty
>> cheap.  And I'm sure there are several such writes when queuing a
>> finalizer.
> 
> 
>> The global volatile gets hit once, when the object is finalized.  Not
>> at every access, which is what you'd have to do with a compiler
>> barrier.
> 
> Perhaps I misunderstood your global volatile suggestion -- when is it
> written to exactly? What's the usage?

In the finalizer.  The idea is that you keep a counter in the
object and then write it to a global when finalized.  I don't
think this can be done much more cheaply without changes to
the compiler, and it's certainly much cheaper than the current
implementation of reachabilityFence.

Andrew.



More information about the Concurrency-interest mailing list