What' s the advantage of LL/SC when compared with CAS (compare-and-swap)?

1.9k views Asked by At

What' s the advantage of LL/SC comparing with CAS(compare and swap) in computer architecture? I think LL/SC can case livelock in many-core system, and case ABA problem, but CAS does not. I can not find out any advantage of LL/SC comparing with CAS. Anyone can tell me?

1

There are 1 answers

4
Jason On

Since nobody has answered, LL/SC does not suffer from the ABA problem since the conditional store will fail if the address referenced by the LL is modified. Furthermore, it can't livelock since one or more LL/SC pairs failing implies another succeeded. A CAS could also potentially be more expensive, since it may require the invalidate queue be flushed.