Docsity

Snooping Cache - Advanced Computer Architecture - Lecture Slides, Slides of Advanced Computer Architecture

Partial preview of the text

Download Snooping Cache - Advanced Computer Architecture - Lecture Slides and more Slides Advanced Computer Architecture in PDF only on Docsity!

Lecture 9 – Snooping Cache and

Directory Based Multiprocessors

MESI Cache Coherence Protocol

  • When a protocol has the property that not all

writes go directly through to memory (a bit is

set instead and the cache line is eventually

written to memory) we call it a write-back

protocol.

  • One popular write-back protocol is called the

MESI protocol.

» It is used by the Intel i7 (actually a variant) and

other CPUs.

» Each cache entry can be in one of four states:

  • Invalid - the cache entry does not contain valid data
  • Shared - multiple caches may hold the line; memory is up to date

MESI Cache Coherence Protocol

» If some other CPU now wants to read the modified line from memory, the cached copy is sent to memory, and all CPUs needing it read it from memory. They are marked as S. » If we write to an uncached line and the write-allocate policy is in use, we will load the line, write to it and mark it as M. » If write-allocate is not in use, the write goes directly to memory and the line is not cached anywhere.

MESI Cache Coherence Protocol

UMA Multiprocessors Using Crossbar

Switches

Sun Enterprise 1000

  • An example of a UMA multiprocessor based on a crossbar switch is the Sun Enterprise 1000. » This system consists of a single cabinet with up to 64 CPUs. » The crossbar switch is packaged on a circuit board with eight plug in slots on each side. » Each slot can hold up to four UltraSPARC CPUs and 4 GB of RAM. » Data is moved between memory and the caches on a 16 X 16 crossbar switch. » There are four address buses used for snooping.

UMA Multiprocessors Using

Multistage Switching Networks

  • In order to go beyond the limits of the Sun Enterprise 1000, we need to have a better interconnection network.
  • We can use 2 X 2 switches to build large multistage switching networks. » One example is the omega network. » The wiring pattern of the omega network is called the perfect shuffle. » The labels of the memory can be used for routing packets in the network. » The omega network is a blocking network.

UMA Multiprocessors Using

Multistage Switching Networks

Implementation Complications

  • Write Races:
    • Cannot update cache until bus is obtained » Otherwise, another processor may get bus first, and then write the same cache block!
    • Two step process: » Arbitrate for bus » Place miss on bus and complete operation
    • If miss occurs to block while waiting for bus, handle miss (invalidate may be needed) and then restart.
    • Split transaction bus: » Bus transaction is not atomic: can have multiple outstanding transactions for a block » Multiple misses can interleave, allowing two caches to grab block in the Exclusive state » Must track and prevent multiple misses for one block
  • Must support interventions and invalidations

Implementing Snooping Caches

  • Multiple processors must be on bus, access to both

addresses and data

  • Add a few new commands to perform coherency,

in addition to read and write

  • Processors continuously snoop on address bus
    • If address matches tag, either invalidate or update
  • Since every bus transaction checks cache tags,

could interfere with CPU just to check:

  • solution 1: duplicate set of tags for L1 caches just to allow checks in parallel with CPU
  • solution 2: L2 cache already duplicate, provided L2 obeys inclusion with L1 cache » block size, associativity of L2 affects L

Performance of Symmetric Shared-Memory

Multiprocessors

  • **Cache performance is combination of
  1. Uniprocessor cache miss traffic
  2. Traffic caused by communication**
    • Results in invalidations and subsequent cache misses
  • 4 th^ C: coherence miss
    • Joins Compulsory, Capacity, Conflict

Coherency Misses

1. True sharing misses arise from the

communication of data through the cache

coherence mechanism

  • Invalidates due to 1 st^ write to shared block
  • Reads by another CPU of modified block in different cache
  • Miss would still occur if block size were 1 word

2. False sharing misses when a block is

invalidated because some word in the block,

other than the one being read, is written into

  • Invalidation does not cause a new value to be communicated, but only causes an extra cache miss
  • Block is shared, but no word in block is actually shared ⇒ miss would not occur if block size were 1 word

A Cache Coherent System Must:

  • Provide set of states, state transition diagram,

and actions

  • Manage coherence protocol
    • (0) Determine when to invoke coherence protocol
    • (a) Find info about state of block in other caches to determine action » whether need to communicate with other cached copies
    • (b) Locate the other copies
    • (c) Communicate with those copies (invalidate/update)
  • (0) is done the same way on all systems
    • state of the line is maintained in the cache
    • protocol is invoked if an “access fault” occurs on the line
  • Different approaches distinguished by (a) to (c)

Bus-based Coherence

  • All of (a), (b), (c) done through broadcast on bus
    • faulting processor sends out a “search”
    • others respond to the search probe and take necessary action
  • Could do it in scalable network too
    • broadcast to all processors, and let them respond
  • Conceptually simple, but broadcast doesn’t

scale with p

  • on bus, bus bandwidth doesn’t scale
  • on scalable network, every fault leads to at least p network transactions
  • Scalable coherence:
  • can have same cache states and state transition diagram
  • different mechanisms to manage protocol