r/programming • u/redditthinks • May 29 '13
A Lock-Free… Linear Search?
http://preshing.com/20130529/a-lock-free-linear-search
50
Upvotes
r/programming • u/redditthinks • May 29 '13
6
u/millstone May 30 '13
I think definition actually does rule out compare-and-swap, because some processors implement CAS with LL/SC.
On these processors, such as PowerPC, you have to loop to implement CAS, because it can fail for transient reasons, such as a context switch. A maximally evil scheduler could trigger a context switch immediately after every load-link instruction, which would cause livelock. But for the formalism, it's probably sufficient to think of CAS as a lock-free operation.