Changes

Jump to: navigation, search

Team False Sharing

431 bytes added, 23:15, 21 December 2017
Eliminating False Sharing
===Thread Local Variables===
Wasting memory to put your data on different cache lines is not ideal solution to the False Sharing problem even though it works. There are 2 problems with this solution: 1 you're wasting memory of course and 2 this solution isn't scalable because you aren't always going to know the L1 cache line size. Using variables local to each thread, instead of contiguous array locations reduces the number of times that a thread will write to a cache line that shares data with threads. The benefit to this approach is that you do not have multiple threads writing to the same cache line, invalidating the data and bottlenecking the processes.
<source lang="cpp">
#include <iostream>
}
</source>
[[File:ExecutionSpeedupLocalSpeedupTl.png|800px|center|frame]]
Wasting memory to put your data on different cache lines is not ideal solution to Here we see that the speedup increases linearly with the False Sharing problem even though it worksnumber of threads used. Using local variables, instead of contiguous array locations, the writes to memory will be spread out to different cache lines The speed up using 4 threads is 3. Another benefit 49 times according to this approach our tests which is that you do not have multiple threads writing much closer to the same cache line, invalidating the data and bottlenecking the processesspeedup predicted by Amdahl's law (3.478 times).
= Intel VTune Amplifier =
96
edits

Navigation menu