...

/

Multithreaded Summation: Using std::lock_guard

Multithreaded Summation: Using std::lock_guard

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

We'll cover the following...

You may have already guessed that using a shared variable for the summation with four threads is not optimal; the synchronization overhead will outweigh the performance benefit. Let me show you the numbers. The questions I want to answer are still the same.

  1. What is the difference in performance between the summation using a lock and an atomic?
...