阅读背景:

为什么CAS(原子)操作比同步或易失操作更快

来源:互联网 

From what I understand, synchronized keyword syncs local thread cache with main memory. volatile keyword basically always reads the variable from the main memory at every access. Of course accessing main memory is much more expensive than local thread cache so these operations are expensive. However, a CAS operation use low level hardware operations but still has to access main memory. So how is a CAS operation any faster?From what I understand, synchronized keyword sy




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: