Re: JavaMemoryModel: how to insert a memory barrier when using java.nio shared memory?

From: Doug Lea (dl@cs.oswego.edu)
Date: Sun Oct 12 2003 - 10:23:06 EDT


> Does (or, perhaps "should", because I didn't see it) JSR 133 say anything
> about java.nio based shared memory use?
>
> ...
>
> [ Having read some of the java.nio API's more closely, I suspect that the
> answer will be that no-one wants to provide/specify anything in this area --
> after all, the java.nio API is deliberately vague on this topic. But, from
> the mailing list archives, no-one else seems to have asked, so I thought it
> wouldn't hurt too much if I did. :) ]

I mention this issue briefly in http://gee.cs.oswego.edu/dl/jmm/cookbook.html
but without giving any practical advice for programmers.

It would be a good idea for the next rev of nio spec (which will NOT
occur in time for 1.5.0/Tiger) to address this. One possibility would
be to somehow integrate some special form of shared memory with JSR166
AtomicXArrays (http://gee.cs.oswego.edu/dl/concurrent/dist/docs/index.html)
which provide volatile semantics (plus CAS operations) for array
elements. Until then, I don't think you'll be able to count on much.

-Doug
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:51 EDT