[concurrency-interest] AtomicReference.updateAndGet() mandatory updating

Nathan and Ila Reynolds nathanila at gmail.com
Fri May 26 16:08:50 EDT 2017


 > "The memory effects of a write occur regardless of outcome."
 > "This method has memory effects of at least one volatile read and write."

I am not sure what memory effects means.  If this is defined somewhere 
in the specs, then ignore this since I haven't read JDK 9 specs.

Does memory effects mean the cache line will be switched into the 
modified state even if an actual write doesn't occur?  Or does memory 
effects have to do with ordering of memory operations with respect to 
the method's operation?

-Nathan
On 5/26/2017 1:59 PM, Doug Lea wrote:
> On 05/26/2017 12:22 PM, Gil Tene wrote:
>
>> Actually this is another case where the Java 9 spec needs to be adjusted…
> The pre-jdk9 method for weak CAS is now available in four
> flavors: weakCompareAndSetPlain, weakCompareAndSet,
> weakCompareAndSetAcquire, weakCompareAndSetRelease.
> They have different read/write access modes. The specs reflect this.
> The one keeping the name weakCompareAndSet is stronger, the others
> weaker than before (this is the only naming scheme that works).
>
> About those specs... see JBS JDK-8181104
>    https://bugs.openjdk.java.net/browse/JDK-8181104
> The plan is for all CAS VarHandle methods to include the sentence
>    "The memory effects of a write occur regardless of outcome."
> And for j.u.c.atomic methods getAndUpdate, updateAndGet,
> getAndAccumulate, accumulateAndGet to include the sentence:
>    "This method has memory effects of at least one volatile read and write."
>
> Which should clear up confusion.
>
> -Doug
>
>
>
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest

-- 
-Nathan



More information about the Concurrency-interest mailing list