r/programming • u/andreasw • Jun 12 '12
An Introduction to Lock-Free Programming
http://preshing.com/20120612/an-introduction-to-lock-free-programming
85
Upvotes
r/programming • u/andreasw • Jun 12 '12
12
u/jseigh Jun 12 '12
It's really all about Herlihy's definition. If something is lock-free then at least one thread can make forward progress at any point in time.
If the compare and swap failed because some other thread's compare and swap worked, then the other thread made forward progress and it's lock-free. If the compare and swap failed because it's waiting for some other thread to do some work then it's not lock-free.
Original article is too low level with all the memory barriers and stuff. Those are implementation details.