[concurrency-interest] AQS.compareAndSetHead CAS abbreviation

Oleksandr Otenko oleksandr.otenko at oracle.com
Wed Dec 31 11:44:15 EST 2014

Setting or Swapping is the same in this case - upon successful CAS(x, 
expected, new) you can tell that the value of x was expected, and now 
set to new. The meaning of swap is that the underlying instruction set 
may permit to load the value of x on failure - that is, if x is not 
expected, tell what it really is; swapping in this case refers to 
swapping the value of register holding expected value for the actual value.


On 31/12/2014 00:39, DT wrote:
> In the AQS class method compareAndSetHead has java doc : /* CAS head field ... */ does it mean compare and set or compare and swap?
> It calls unsafe.compareAndSwapObject
> Thanks

More information about the Concurrency-interest mailing list