35
edits
Changes
→Signs of false sharing
False sharing is more than two threads updating at lease two independence element in the same cache line. False sharing occurs when processors in a shared-memory parallel system refer to data objects within a same cache line. So that the simple compared the contents of adjacent memory in the same cache line to those on the committed page can detect false sharing.
let’s take an example.
[[File:False-sharing.png]]
Thread 0 and thread 2 are executed and stored data in same cache line, which are sum[0] and sum[2]. HW thread 0 alter variable sum[0], Thread 2 is going to change value in Sum[2]. As the thread 0 finish the process. The changed must reflect on the cache line before thread 2 execute.