Single Threaded Summation: Protection with Atomics
Accordingly, I have the same questions for atomics that I had for locks.
- How expensive is the synchronization of an atomic?
- How fast can an atomic be if there is no contention?
I have an additional question: what is the performance difference of an atomic compared to a lock?