RFR: 8207851 JEP Draft: Support ByteBuffer mapped over non-volatile memory

Andrew Dinn adinn at redhat.com
Thu Sep 27 10:41:11 UTC 2018

Hi Peter,

On 27/09/18 11:28, Peter Levart wrote:

> May I just note that multithreaded bulk operations are kind of possible
> without external synchronization (i.e. locks) if you follow a simple
> protocol:
> - never use relative operations on the shared ByteBuffer instance
> - never use operations that change internal
> mark/position/limit/byteOrder on the shared ByteBuffer instance
> - a concurrent bulk operation on 'bb' consists of:
> ByteBuffer myBb = bb.slice(0, bb.capacity());
> // use myBb to perform concurrent bulk operation (any operations are
> allowed) and then throw it away or cache it in ThreadLocal
> If you combine this with explicit fences and/or atomic 16, 32 and 64 bit
> operations via VarHandles. (see
> MethodHandles.byteBufferViewVarHandle(Class, ByteOrder)), concurrent
> programming with ByteBuffer(s) is entirely possible.
Thank you for the usual expert advice. I am sure it will be of great
help in implementing a persistent data management library over this
JEP's base capability.


Andrew Dinn
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander

More information about the core-libs-dev mailing list