Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The lock could still be faster. atomic ops are more expensive than regular opcodes even when there is zero contention. On x86, a lock requires only a single atomic opcode and can be released with a normal write (because of TSO). Since it's uncontended it won't spin at all. Therefore, any alternative lock-free algorithm that uses more than a single atomic op is actually more expensive.


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

Search: