Description:

  • Problem: processors cache shared data but each core has their own cache, then they might have (incoherent) values for the same memory location

Snooping:

  • Every cache that has a copy of the data from a block of the memory also has a copy of the sharing status of the block but no centralized status is kept
  • Cache controller snoop on the shared bus to determine whether or not they have a copy of a block that is requested on the bus
  • But Snooping doesn’t scale

Cache coherence protocols based on snooping:

  • Write Invalidate Protocol:

    • With write-thru cache:
    • ex
StepEventbusx in core 0x in core 1x in mem
00
1Core 0 reads xcache miss00
2Core 1 reads xcache miss000
3Core 0 write 1 to xinvalidate x1x0 (doesnt change yet)
4Core 1 reads xcache miss111 (change here)
  • Modified Shared Invalid Protocol:
    1. States and Transitions: The MSI protocol defines three states for cache blocks: Modified, Shared, and Invalid.
      • The Modified state indicates that a cache block has been modified and differs from the main memory.
      • The Shared state indicates that the cache block is valid and has multiple copies across different caches.
      • The Invalid state denotes that the cache block is invalid or not present in the cache.
    2. Handling Modified and Shared Data: In the MSI protocol, when a cache block is in the Modified state, any write operation triggers an invalidation of other copies in different caches.
      • The Modified state allows the cache to retain ownership of the block, ensuring exclusive modification rights.
      • When a cache block is in the Shared state, read operations can be performed, but write operations require transitioning to the Modified state.
  • Modied Owner Shared Invalid Protocol
    1. Introduction to Owned State: The MOSI protocol extends the MSI protocol by introducing an additional Owned state. The Owned state indicates that a cache holds the exclusive ownership of a block, allowing both read and write operations without invalidating other copies.
    2. Improved Handling of Ownership: The Owned state in the MOSI protocol provides an advantage over the MSI protocol. When a cache wants to modify a block in the Owned state, it can directly update the block without invalidating other copies. This reduces bus traffic and improves performance compared to the MSI protocol.
  • Modified Exclusive Shared Invalid Protocol
    1. Widely Used Cache Coherence Protocol: The MESI protocol is one of the most commonly used cache coherence protocols. It extends the MSI protocol by introducing the Exclusive state, which allows a cache to hold a copy of a block exclusively, indicating that no other cache has a copy.
    2. Advantages of Exclusive and Modified States: The Exclusive state in the MESI protocol enables faster read operations by allowing caches to read the block without checking for other copies. When a cache wants to modify a block in the Exclusive state, it can transition to the Modified state directly without invalidating other copies. This reduces the need for unnecessary bus transactions, enhancing performance.
  • Modified Owner Exclusive Shared Invalid Protocol, …

Directory-based protocols

  • Caches & memory record blocks’ sharing status in directory
  • directory protocols are slower