java.nio.*Buffer read/write atomicity

Alan Bateman Alan.Bateman at
Wed Dec 19 19:02:36 UTC 2012

On 19/12/2012 18:56, Aleksey Shipilev wrote:
> On 12/19/2012 10:45 PM, Alan Bateman wrote:
>> On memory model rules then there is is an outstanding bug to update the
>> buffer spec with at least minimal properties. Doug might remember the
>> discussion with Dave Dice about this a few years ago. I've always meant
>> to do it but it never got to the top of the list.
> Aha, thanks, Alan. Does anyone has the CR number handy? Searching
> through bugtrack has a lots of false hits.

>> That aside, I'm not aware of any discussion about the atomicity issue
>> that you are concerned about now. As buffers are accessed directly in
>> native code and by system calls then I think you would be limited to
>> only specifying the put and get methods.
> I don't think there are problems with full-width ops in non-BB
> implementations. The problematic area seems to be ByteBuffer allocated
> on heap. Direct ByteBuffer seems to be atomic.
I don't think we can make assumptions about the access to direct buffers 
because it's it may not go through the Buffer API.


More information about the core-libs-dev mailing list