A private software field need not occupy a private coherence line. Extend the course model with two aligned eight-byte words: X at byte offset 0 and Y at offset 8 of the same 64-byte line. Both start at 0 with no cached copies. Use MESI. C0 writes only X and C1 writes only Y. They share a permission unit without sharing a logical variable: false sharing.
Independent access pattern | Logical sharing | Permission consequence |
|---|---|---|
C0 and C1 update X | True sharing of X | Writes to the same line require exclusive permission. |
C0 updates X, C1 updates neighbouring Y | False sharing | The same permission transfers despite distinct fields. |
C0 updates X, C1 updates Y in another line | Separate writable data | Each can retain its own line's write permission. |
The exclusive-permission transfer itself is the trace in Three-Hop Versus Four-Hop: C0 holds the line in M and C1 asks for write permission. It is not redrawn here. What this lesson adds is the second word. The line carries X and Y together, so every transfer must preserve every word. If C0 writes X = 1 before C1 writes Y = 1, the final line must contain both 1s. Refilling the line from stale memory and keeping only C1's Y would be a correctness failure, not false-sharing overhead.
The snapshots below are settled states after each completed store (MESI, X at offset 0, Y at offset 8 of one line, both starting at 0). The whole line moves with the permission, and memory stays 0 because nothing has been written back.
After | C0 state / value | C1 state / value | H | Memory | Newest data |
|---|---|---|---|---|---|
Start | I / - | I / - | U | memory = 0 | Memory: X = 0, Y = 0 |
C0 stores X = 1 | M / X = 1, Y = 0 | I / - | exclusive(C0) | memory = 0 | C0: X = 1, Y = 0 |
C1 stores Y = 1 | I / - | M / X = 1, Y = 1 | exclusive(C1) | memory = 0 | C1: X = 1, Y = 1 |
The false-sharing label explains unnecessary communication for this algorithm. It does not claim every transfer is slow or give a cycle estimate. Batching writes may reduce changes of exclusive holder even when addresses stay together. Padding changes the permission relationship; batching changes the access schedule.
Before proposing either fix, record byte offsets, write frequency, core placement and the interval of interest. A read-only neighbouring field can also be repeatedly invalidated by a writer, even though the alternating two-writer counter example is easier to count.
No. False sharing increases legal communication. Losing the newest X while preserving only Y violates the data-value obligation.