1 Lecture 3: Coherence Protocols Topics: consistency models, coherence protocol examples.

Slides:



Advertisements
Similar presentations
1 Lecture 20: Synchronization & Consistency Topics: synchronization, consistency models (Sections )
Advertisements

1 Lecture 12: Hardware/Software Trade-Offs Topics: COMA, Software Virtual Memory.
The University of Adelaide, School of Computer Science
1 Lecture 19: Shared-Memory Multiprocessors Topics: coherence protocols for symmetric shared-memory multiprocessors (Sections )
CS 7810 Lecture 19 Coherence Decoupling: Making Use of Incoherence J.Huh, J. Chang, D. Burger, G. Sohi Proceedings of ASPLOS-XI October 2004.
1 Lecture 4: Directory-Based Coherence Details of memory-based (SGI Origin) and cache-based (Sequent NUMA-Q) directory protocols.
CS252/Patterson Lec /23/01 CS213 Parallel Processing Architecture Lecture 7: Multiprocessor Cache Coherency Problem.
1 Lecture 7: Consistency Models Topics: sequential consistency, requirements to implement sequential consistency, relaxed consistency models.
1 Lecture 2: Snooping and Directory Protocols Topics: Snooping wrap-up and directory implementations.
1 Lecture 20: Coherence protocols Topics: snooping and directory-based coherence protocols (Sections )
1 Lecture 1: Introduction Course organization:  4 lectures on cache coherence and consistency  2 lectures on transactional memory  2 lectures on interconnection.
1 Lecture 3: Snooping Protocols Topics: snooping-based cache coherence implementations.
1 Lecture 24: Multiprocessors Today’s topics:  Directory-based cache coherence protocol  Synchronization  Consistency  Writing parallel programs Reminder:
Lecture 13: Consistency Models
1 Lecture 18: Coherence Protocols Topics: coherence protocols for symmetric and distributed shared-memory multiprocessors (Sections )
1 COMP 206: Computer Architecture and Implementation Montek Singh Mon, Nov 14, 2005 Topic: Cache Coherence.
1 Lecture 5: Directory Protocols Topics: directory-based cache coherence implementations.
1 Lecture 23: Multiprocessors Today’s topics:  RAID  Multiprocessor taxonomy  Snooping-based cache coherence protocol.
1 Lecture 15: Consistency Models Topics: sequential consistency, requirements to implement sequential consistency, relaxed consistency models.
1 Lecture 2: Intro and Snooping Protocols Topics: multi-core cache organizations, programming models, cache coherence (snooping-based)
1 Lecture 18: Shared-Memory Multiprocessors Topics: coherence protocols for symmetric shared-memory multiprocessors (Sections )
1 Lecture 22: Synchronization & Consistency Topics: synchronization, consistency models (Sections )
1 Lecture 20: Protocols and Synchronization Topics: distributed shared-memory multiprocessors, synchronization (Sections )
Snoopy Coherence Protocols Small-scale multiprocessors.
Multiprocessor Cache Coherency
Lecture 7: PCM, Cache coherence
Presented By:- Prerna Puri M.Tech(C.S.E.) Cache Coherence Protocols MSI & MESI.
Lecture 13: Multiprocessors Kai Bu
Ch4. Multiprocessors & Thread-Level Parallelism 2. SMP (Symmetric shared-memory Multiprocessors) ECE468/562 Advanced Computer Architecture Prof. Honggang.
Effects of wrong path mem. ref. in CC MP Systems Gökay Burak AKKUŞ Cmpe 511 – Computer Architecture.
1 Lecture 12: Hardware/Software Trade-Offs Topics: COMA, Software Virtual Memory.
Cache Coherence Protocols A. Jantsch / Z. Lu / I. Sander.
1 Lecture 19: Scalable Protocols & Synch Topics: coherence protocols for distributed shared-memory multiprocessors and synchronization (Sections )
Cache Coherence CS433 Spring 2001 Laxmikant Kale.
1 Lecture 25: Multiprocessors Today’s topics:  Synchronization  Consistency  Shared memory vs message-passing  Simultaneous multi-threading (SMT)
1 Lecture: Coherence Protocols Topics: snooping-based protocols.
1 Lecture 17: Multiprocessors Topics: multiprocessor intro and taxonomy, symmetric shared-memory multiprocessors (Sections )
1 Lecture 7: PCM Wrap-Up, Cache coherence Topics: handling PCM errors and writes, cache coherence intro.
1 Lecture: Coherence Topics: snooping-based coherence, directory-based coherence protocols (Sections )
1 Lecture 7: Implementing Cache Coherence Topics: implementation details.
CMSC 611: Advanced Computer Architecture Shared Memory Most slides adapted from David Patterson. Some from Mohomed Younis.
The University of Adelaide, School of Computer Science
Lecture 13: Multiprocessors Kai Bu
1 Lecture 8: Snooping and Directory Protocols Topics: 4/5-state snooping protocols, split-transaction implementation details, directory implementations.
Lecture 20: Consistency Models, TM
COSC6385 Advanced Computer Architecture
Lecture 11: Consistency Models
Lecture 18: Coherence and Synchronization
Lecture 26: Multiprocessors
Lecture 2: Snooping-Based Coherence
Lecture 5: Snooping Protocol Design Issues
Lecture 4: Update Protocol
Lecture 21: Synchronization and Consistency
Lecture 22: Consistency Models, TM
Lecture 25: Multiprocessors
Lecture 10: Consistency Models
Lecture 25: Multiprocessors
Lecture 26: Multiprocessors
Lecture 24: Virtual Memory, Multiprocessors
Lecture 24: Multiprocessors
Lecture: Coherence, Synchronization
Lecture: Coherence Topics: wrap-up of snooping-based coherence,
Lecture 3: Coherence Protocols
Prof John D. Kubiatowicz
Lecture 21: Synchronization & Consistency
Lecture: Coherence and Synchronization
Lecture: Consistency Models, TM
Lecture 19: Coherence and Synchronization
Lecture 18: Coherence and Synchronization
Lecture 11: Consistency Models
Presentation transcript:

1 Lecture 3: Coherence Protocols Topics: consistency models, coherence protocol examples

2 Sequential Consistency A multiprocessor is sequentially consistent if the result of the execution is achievable by maintaining program order within a processor and interleaving accesses by different processors in an arbitrary fashion For example, the code below should ensure mutual exclusion on a sequentially consistent machine Initially A = B = 0 P1 P2 A  1 B  1 … … if (B == 0) if (A == 0) Crit.Section Crit.Section

3 Relaxing Memory Ordering Executing memory accesses in order is extremely slow; we attempt optimizations  seq consistency is lost For example, each processor can be out-of-order; within P1, the write to A and the read of B are independent since they refer to different memory locations Ooo execution will allow each process to enter CS Initially A = B = 0 P1 P2 A  1 B  1 … … if (B == 0) if (A == 0) Crit.Section Crit.Section

4 Relaxed Consistency Models In order to write correct programs, the programmer must understand that memory accesses do not always happen in order The consistency model specifies how memory ordering differs from that of sequential consistency If the programmer demands sequential consistency in places, he/she can impose it with special fence instructions – a fence ensures that we make progress only after completing earlier memory accesses Fences are slow – a better understanding of the program and the consistency model can eliminate some fences

5 Cache Coherence A multiprocessor system is cache coherent if a value written by a processor is eventually visible to reads by other processors – write propagation two writes to the same location by two processors are seen in the same order by all processors – write serialization

6 Cache Coherence Protocols Directory-based: A single location (directory) keeps track of the sharing status of a block of memory Snooping: Every cache block is accompanied by the sharing status of that block – all cache controllers monitor the shared bus so they can update the sharing status of the block, if necessary  Write-invalidate: a processor gains exclusive access of a block before writing by invalidating all other copies  Write-update: when a processor writes, it updates other shared copies of that block

7 Protocol-I MSI 3-state write-back invalidation bus-based snooping protocol Each block can be in one of three states – invalid, shared, modified (exclusive) A processor must acquire the block in exclusive state in order to write to it – this is done by placing an exclusive read request on the bus – every other cached copy is invalidated When some other processor tries to read an exclusive block, the block is demoted to shared

8 Design Issues, Optimizations When does memory get updated?  demotion from modified to shared?  move from modified in one cache to modified in another? Who responds with data? – memory or a cache that has the block in exclusive state – does it help if sharers respond? We can assume that bus, memory, and cache state transactions are atomic – if not, we will need more states A transition from shared to modified only requires an upgrade request and no transfer of data Is the protocol simpler for a write-through cache?

9 4-State Protocol Multiprocessors execute many single-threaded programs A read followed by a write will generate bus transactions to acquire the block in exclusive state even though there are no sharers Note that we can optimize protocols by adding more states – increases design/verification complexity

10 MESI Protocol The new state is exclusive-clean – the cache can service read requests and no other cache has the same block When the processor attempts a write, the block is upgraded to exclusive-modified without generating a bus transaction When a processor makes a read request, it must detect if it has the only cached copy – the interconnect must include an additional signal that is asserted by each cache if it has a valid copy of the block

11 Design Issues When caches evict blocks, they do not inform other caches – it is possible to have a block in shared state even though it is an exclusive-clean copy Cache-to-cache sharing: SRAM vs. DRAM latencies, contention in remote caches, protocol complexities (memory has to wait, which cache responds), can be especially useful in distributed memory systems The protocol can be improved by adding a fifth state (owner – MOESI) – the owner services reads (instead of memory)

12 Update Protocol (Dragon) 4-state write-back update protocol, first used in the Dragon multiprocessor (1984) Write-back update is not the same as write-through – on a write, only caches are updated, not memory Goal: writes may usually not be on the critical path, but subsequent reads may be

13 4 States No invalid state Modified and Exclusive-clean as before: used when there is a sole cached copy Shared-clean: potentially multiple caches have this block and main memory may or may not be up-to-date Shared-modified: potentially multiple caches have this block, main memory is not up-to-date, and this cache must update memory – only one block can be in Sm state In reality, one state would have sufficed – more states to reduce traffic

14 Design Issues If the update is also sent to main memory, the Sm state can be eliminated If all caches are informed when a block is evicted, the block can be moved from shared to M or E – this can help save future bus transactions Having an extra wire to determine exclusivity seems like a worthy trade-off in update systems

15 Examples P1 P2 MSIMESI Dragon MSI MESI Dragon P1: Rd X P1: Wr X P2: Rd X P1: Wr X P2: Rd X P2: Wr X Total transfers:

16 Title Bullet