6.1The Big Picture

book pp. 91–93 · ~5 min read

  • coherence controller
  • cache controller
  • memory controller
  • coherence transaction

This chapter returns to cache coherence, defined back in chapter 2 to understand its role in supporting consistency — but chapter 2 never said how coherence protocols work. This chapter covers protocols in general: the big picture here, the specification methodology in §6.2, one simple concrete protocol in §6.3, and the design space in §6.4. The two chapters after that cover the two great protocol families — snooping and directory — in depth.

Distributed state machines

The goal of a coherence protocol is to enforce the two invariants of §2.4, restated:

The enforcement mechanism: associate with each storage structure — each cache, and the LLC/memory — a finite state machine called a coherence controller . Together the controllers form a distributed system, exchanging messages to keep both invariants holding for every block at all times. The coherence protocol is precisely the specification of how these state machines interact.

The two controller types

Coreloads and storesloaded valuesCacheControllerCachecore side ↑network side ↓issued coherencerequests & responsesreceived coherencerequests & responsesInterconnection NetworkFigure 6.1: cache controllerLLC/MemoryControllerMemorynetwork side onlyissued coherenceresponsesreceived coherencerequestsInterconnection NetworkFigure 6.2: memory controller

Figures 6.1 and 6.2 (recreated): the two coherence controller types. The memory controller is a cache controller minus the core side.

The cache controller serves two masters. On its core side, it accepts loads and stores from the processor core and returns loaded values. A cache miss makes the controller start a coherence transaction by issuing a coherence request for the block (e.g., a request for read-only permission) across the interconnection network; the transaction consists of that request plus the other messages exchanged to satisfy it (e.g., a data response from another controller). On its network side, it receives and processes the coherence requests and responses of others. Which transactions and messages exist depends on the specific protocol.

The memory controller at the LLC/memory is the same idea with the core side removed: it usually has only a network side, so it does not issue coherence requests on behalf of loads or stores, and does not receive coherence responses. Other agents — I/O devices, for instance — may behave like cache controllers, memory controllers, or both.

One state machine per block

Each controller implements a set of finite state machines — logically one independent but identical FSM per block. When an event of type E (say, a store request from the core) arrives for block B, the controller takes actions that are a function of both E and B’s current state (say, issue a request for read-write permission because B is read-only), and may then change B’s state.

That “function of event and state” phrasing is no accident: it is exactly the shape of a table — and tables are how the book (and this site) specifies every protocol from here on. On to §6.2.

Check yourself

1.What, concretely, enforces the SWMR and data-value invariants in a coherent system?

2.A cache controller has a core side and a network side. What happens on each?

3.How does the memory controller (at the LLC/memory) differ from a cache controller?

4.When an event of type E arrives for block B, what determines the controller's behavior?

4 questions