[concurrency-interest] 8145539: (coll) AbstractMap.keySet and .values should not be volatile
vitalyd at gmail.com
Tue Apr 26 15:16:15 EDT 2016
Yes, I believe JVMs are not allowed to introduce phantom reads or writes.
In other words, reading a plain field into a local (and only using the
local) in java means it will not be re-read, whereas no such guarantee
exists in C/C++. Relatedly, that blog shows a case where gcc and clang
read and write, back-to-back(!), a field to memory -- that is also not
allowed in conforming JVMs, AFAIK.
On Tue, Apr 26, 2016 at 3:12 PM, Justin Sampson <jsampson at guidewire.com>
> Vitaly Davidovich wrote:
> > The problem is compilers can do weird things on the assumption of
> > data race free code. If you haven't seen
> > I recommend reading it. It's in the context of C/C++/Go but the
> > general point stands.
> Interesting -- that article actually seems to describe cases of
> thin-air reads due to the compiler reusing memory locations, which
> is impossible in Java even for racy code, right?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest