Sequential Consistency and Cache Coherence Protocols: Computer Science and Artificial Intelligence Lab M.I.T
Sequential Consistency and Cache Coherence Protocols: Computer Science and Artificial Intelligence Lab M.I.T
Sequential Consistency
and
Arvind
M.I.T.
6.823 L17- 2
Arvind
CPU-1 CPU-2
CPU-Memory bus
A 100 memory
X= 1 X=1 Y=
Y=11 Y =11 Y’=
• T1 executed
X’= X=0
Y’= X’=
X= 1 X=1 Y = 11
• T2 executed
Y=11 Y =11 Y’= 11
X’= 0 X=0
Y’=11 X’= 0
November 9, 2005
6.823 L17- 6
Arvind
P P P P
L1 L1 L1 L1
P
P L1
L1 L2 L2
Interconnect
M
a ∈ Li ⇒ a ∈ Li+1
November 9, 2005
6.823 L17- 7
Arvind
write request:
the address is invalidated (updated) in all other
caches before (after) the write is performed
read request:
November 9, 2005
6.823 L17- 8
Arvind
R/W
Page transfers
occur while the
Processor is running
A
Either Cache or DMA can D
DMA
be the Bus Master and DISK
R/W
effect transfers
November 9, 2005
6.823 L17- 9
Arvind
DMA
DISK
Memory Disk: Physical memory may be
stale if Cache copy is dirty
November 9, 2005
6.823 L17- 10
Arvind
A A
Tags and Snoopy read port
State attached to Memory
Proc. R/W R/W
Bus
Data
D (lines)
Cache
November 9, 2005
6.823 L17- 11
Arvind
November 9, 2005
6.823 L17- 12
Arvind
Memory
Bus
Snoopy
M1 Cache Physical
Memory
Snoopy
M2 Cache
November 9, 2005
6.823 L17- 13
Arvind
rite
w Other processor
to
n ts intents to write
t e
in
Read
P1
miss
S I
Read by any
Other processor
processor
intents to write
Cache state in
processor P1
November 9, 2005
6.823 L17- 14
Arvind
2 Processor Example
P1 reads
P1 reads P1 P2 reads, or writes
P1 writes P1 writes back
M
P2 reads Write miss
rite
P2 writes
tow P2 intent to write
P1 reads t
in ten
P1 writes Read P1
miss
P2 writes S I
P1 writes P2 intent to write
P2 P1 reads,
P2 reads
or writes
P2 writes back M
Write miss
e
writ
t to P1 intent to write
ten
Read in
P2
miss
S I
P1 intent to write
November 9, 2005
6.823 L17- 15
Arvind
Observation
P1 reads
S I
Read by any Other processor
processor intents to write
P1 write P1 read
P1 write M E
or read
Write miss
it e
Other processor reads w r Other processor
P1 writes back t to intent to write
n
Read miss, te
in
shared P1
S
I
Read by any Other processor
Cache state in
processor P1
November 9, 2005
17
6.823 L17- 18
Arvind
November 9, 2005
6.823 L17- 19
Arvind
2-Level Caches
CPU CPU CPU CPU
L1 $ L1 $ L1 $ L1 $
L2 $ L2 $ L2 $ L2 $
Intervention
CPU-1 CPU-2
CPU-Memory bus
False Sharing
November 9, 2005
6.823 L17- 22
Arvind
cache mutex=1
cache cache
CPU-Memory Bus
November 9, 2005
6.823 L17- 23
occupancy
In general, a read-modify-write instruction
processors
November 9, 2005
6.823 L17- 25
Arvind
Performance:
Load-reserve & Store-conditional
November 9, 2005
6.823 L17- 26
Arvind
snooper
Wb-req, Inv-req, Inv-rep
load/store
buffers
pushout (Wb-rep) Memory
Cache
CPU
(S-req, E-req)
Blocking caches CPU/Memory
One request at a time + CC ⇒ SC Interface
Non-blocking caches
Multiple requests (different addresses) concurrently + CC
⇒ Relaxed memory models
CC ensures that all processors observe the same
order of loads and stores to an address
November 9, 2005
6.823 L17- 27
Arvind
next time
November 9, 2005
28
Thank you !
6.823 L17- 29
Arvind
2 Processor Example
P1 write P1 read
Block b P1 write
or read
M E
Write miss
P2 reads, rite
ow
P1
P1 writes back
ten
t t P2 intent to write
Read
in
P1
miss
S I
P2 intent to write
P2 write P2 read
P2 write
Block b or read
M E
Write miss
e
P1 reads, writ
P2
P2 writes back t to P1 intent to write
ten
Read
in
P2
miss
S I
P1 intent to write
November 9, 2005