[jmm-dev] Specifying VarHandle acquire/release without ill effects
Martin Buchholz
martinrb at google.com
Mon Jun 20 17:48:31 UTC 2016
On Sat, Jun 18, 2016 at 4:50 AM, Doug Lea <dl at cs.oswego.edu> wrote:
>
> But we then discovered that doing this encountered some unsolved
> research problems. Mainly that the current C/C++ model relies on rules
> saying that programs with data races have no semantics ... Plus there are
> a few
> minor-mismatch snags that do not seem hard to address, including that
> plain Java variables are a little stronger than plain C/CC variables
> (for example references cannot be word-torn), but weaker than atomics
> in relaxed mode (they are not required to be coherent).
>
My mental model is to map plain old java variables to C++ relaxed atomics,
except for long and double, which could perhaps be mapped to an array of
atomic bytes, technically eliminating all data races. Both C++ and Java
try to prevent OOTA results, and both succeed in practice, if not in theory.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3710.html
More information about the jmm-dev
mailing list