logoalt Hacker News

8by3today at 12:05 PM3 repliesview on HN

real people don't write "compare-and-swap" ... or "lo-and-behold" for that matter.

edit. Clearly the joke about "lo-and-behold" didn't land well with the bots...


Replies

ninjaoxygentoday at 12:18 PM

People who grew up with assembly language or locking primitives are fairly likely to use compare-and-swap because it's literally the commonly understood term for it.

https://en.wikipedia.org/wiki/Compare-and-swap

show 1 reply
BenoitPtoday at 12:25 PM

Compare-and-swap is a hardware instruction, and beyond that a desirable pattern for dealing with concurrent writes.

CMPXCHG

https://www.felixcloutier.com/x86/cmpxchg

https://lwn.net/Articles/847973/

lelanthrantoday at 2:37 PM

I do.

For compare-and-swap I have even got a lock less queue that I implemented with it.