It's important to note that even at the hardware level(for intel x64, at least), atomic increments and decrements are, in fact, just the operations with locks around them.
So relying heavily on them in multithreaded cases with heavy contention can actually reduce performance over a more complex lockless scheme.
Comments
It's important to note that even at the hardware level(for intel x64, at least), atomic increments and decrements are, in fact, just the operations with locks around them.
So relying heavily on them in multithreaded cases with heavy contention can actually reduce performance over a more complex lockless scheme.