Thread Local Summation: Using Tasks

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

Using tasks, we can do the whole job without synchronization. Each partial summation is performed in a separate thread and the final summation takes place in the main thread.

Here is the program:

Get hands-on with 1000+ tech skills courses.