[concurrency-interest] Atomics for ByteBuffer

David Holmes davidcholmes at aapt.net.au
Mon Jul 22 19:36:11 EDT 2013

Indeed this needs to follow the JEP process in general:


which may, or may not, lead to a JSR.

Discussion needs to be initiated on the appropriate openjdk mail alias -
probably nio-dev in this case.

  -----Original Message-----
  From: concurrency-interest-bounces at cs.oswego.edu
[mailto:concurrency-interest-bounces at cs.oswego.edu]On Behalf Of Nathan
  Sent: Tuesday, 23 July 2013 4:09 AM
  To: concurrency-interest at cs.oswego.edu
  Subject: Re: [concurrency-interest] Atomics for ByteBuffer

  I am not sure.  I suppose you would need to create a JSR or JEP or
something of that nature.

-NathanOn 7/21/2013 3:54 AM, Martin Thompson wrote:

    How would we progress such a change to have an AtomicByteBuffer?


    > I see a need for ByteBuffer with atomics (say AtomicByteBuffer).
    > Infiniband supports atomic operations over the network.  If Infiniband
    > atomics were linked to processor atomics and the program uses
    > AtomicByteBuffer, then 2 processes on different machines could execute
    > atomic operations on the same piece of memory.
    > One problem is that the atomic operations can't straddle 2 cache
    > If alignment is required, that problem would be solved.
    > -Nathan
    > On 7/19/2013 6:03 AM, Vitaly Davidovich wrote:
    > ByteBuffer is not spec'd to be threadsafe, IIRC. Adding these methods
    > there would lead to confusion, I think, if they remain spec'd as
    > such.  Maybe a separate impl can be created to support atomics?
    > > Sent from my phone
    > > On Jul 19, 2013 8:46 AM, "Martin Thompson" <mjpt777 at gmail.com
    > <mailto:mjpt777 at gmail.com>> wrote:
    >     One of the most common uses I see for Unsafe is building IPC
    >     implementations.  If we want folk to stop using Unsafe then we
    >     need to give them an alternative.
    >     Is there any reason why we cannot add atomic methods like
    >     putOrderedX, putVolatileX, getVolatileX, getAndAddX,
    >     compareAndSetX to ByteBuffer?
    >     With these new methods an IPC implementation can be built using
    >     memory mapped files without resorting to using Unsafe.
    >     Regards,
    >     Martin...

Concurrency-interest mailing list
Concurrency-interest at cs.oswego.edu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20130723/d4c9ae16/attachment-0001.html>

More information about the Concurrency-interest mailing list