Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Can someone make a CAS just checking last bit on x86/ARM please?
1 point by goofy_lemur 2 hours ago | hide | past | favorite | 1 comment
Guys/gals, I was thinking about doing some work here and I noticed there's no operation that allows a atomic compare/exchange based on the last bit.

There should be an instruction that allows you to do an update of a 64 bit value only if the last bit is a 0.

The idea here is you would be able to swap pointer values atomically only if they were unlocked.

2^63 is such a huge number, it is sufficient to represent practically all the data in the universe. If we allowed an atomic compare exchange on the last bit, or something like check if the last bit is 0, allow the write, otherwise don't, it would make programming a lot easier.

Thanks!





You're going to have to give a much clearer set of examples and justifications. I've had to CAS on bit masks, but not enough that it would make sense to introduce a new operation for it. I just CAS and spin if it fails and the bitmask is still valid.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: