Single Threaded Summation: Protection with Atomics

This lesson explains the solution for calculating the sum of a vector problem using atomics in C++.

Accordingly, I have the same questions for atomics that I had for locks.

  1. How expensive is the synchronization of an atomic?
  2. 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?

Get hands-on with 1000+ tech skills courses.