32
edits
Changes
→Example
The reason for this is the synchronization and cache invalidation overheads cause the slower execution time for the multi-threaded solution. Despite the execution being split between 2 threads.
Although if the number of iterations is increased. At some point running the solution in serial willcause it to run slower then the multi threaded solution. Why is so?
[[File:False Analyzing Test 2.PNG]]
By increasing the NUM_ITERATIONS it causes the serial solution to run slower because the loop in in the serial solution is excecated sequentially.
As a result more work is being applied on the thread which causes it to bottleneck.
Meanwhile the multi threaded solution does not cause a bottle neck because the work is split between 2 threads allowing them to work on '''less''' iterations at the '''same''' time.
As a result it decreases the amount of time it takes to run through those iterations.
== Sources ==