On a intel i3, i5, i7 x86 64 bits cpu, for instance, is it true that CAS only guarantee atomic on max. 8 bytes object size?
on x86 cpu, lock instruction is add to CAS operation, eg. CMPXCHG
, which means the the whole cache line is locked for the reading cpu, so std::atomic::compare_exchange_weak()
will not return fault for spurious failure reason?
If x86 cpu use lock
at CAS operation, what is the performance gain if use lock free programming instead of use std::mutex on share resource?
If i want to write a lock free linked-list for example. I do atomic load on the header node's pointer and compare it with std::atomic::compare_exchange_weak()
to see any changes has been made. In this case, does ABA problem apply on x86 cpu?