Cache Line Bouncing

A and B are different variables, but both live in Cache Line #42. So the whole line has to move between cores.

Loop: 1 · Step: 0/4
64B CACHE LINE
#42
Core 0 A thread
A++ BLOCKED
Local cache
Cache Line #42 Invalid
A = 10
B = 20
shared cache line
CACHE LINE #42 64B
A = 10
B = 20
A
A
B
B
Current owner: Core 0
separate padded cache lines
CACHE LINE #42 64B · Core 0
A = 10
A
pad
pad
pad
pad
pad
pad
pad
Owner: Core 0
CACHE LINE #43 64B · Core 1
B = 20
B
pad
pad
pad
pad
pad
pad
pad
Owner: Core 1
Core 1 B thread
B++ BLOCKED
Local cache
Cache Line #42 Invalid
A = 10
B = 20
1 · ModifyCurrent owner changes its variable
2 · BlockedOther core cannot write yet
3 · Move lineThe whole 64B line travels
4 · ModifyNew owner writes its variable