Fig. 2.

Download original image
Parallel reduction of an array using a thread spawning library (right). Each thread is given an equal chunk of the initial array to reduce via the reduceChunk function (left). The master thread waits for each spawned threads to finish and finally adds the intermediary results together.