False Sharing and Cache-Line Ownership Traffic
Diagnose why independent counters can slow each other down when their storage occupies the same coherence unit.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Two addresses can have one ownership state
If two cores repeatedly write distinct four-byte counters in the same 64-byte line, the variables have no logical data dependency. Nevertheless each core needs suitable authority for the line. The ownership can move between them because a write to either counter modifies the coherence unit. The cost can appear even if each processor otherwise uses only its own logical object.
Alter layout or update frequency
A per-worker counter can be separated by layout, or updates can be accumulated locally and merged less often. Padding increases working-set size, so compare it against locality and storage cost. Test with a controlled workload and documented line size rather than assuming every alignment helps. Coherence gives the ownership mechanism. Cache miss analysis distinguishes such transfers from ordinary capacity pressure.[1]