Open main menu

CDOT Wiki β

Changes

Team False Sharing

26 bytes added, 23:24, 17 December 2017
m
Eliminating False Sharing
=Eliminating False Sharing=
===Padding===
[[File:Speedup.png|right850px|center]]
<source lang ="cpp">
#define CACHE_LINE_SIZE 64
}
</source>
[[File:ExecutionSpeedupLocal.png|800px|center|frame]]
Wasting memory to put your data on different cache lines is not ideal solution to the False Sharing problem even though it works. Using local variables, instead of contiguous array locations, the writes to memory will be spread out to different cache lines. Another 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.
30
edits