6.1.6 · D1Parallelism & Multicore

Foundations — Cache coherence at scale (directory-based)

2,750 words13 min readBack to topic

Before you can read the parent note Cache coherence at scale (directory-based), you need to understand every word and symbol it throws at you. We build each one from nothing — a picture first, then the meaning, then why the topic needs it.


1. A core, and why it has a private cache

In figure s01, follow the violet boxes on top — those are the cores. Directly under each hangs its own orange cache; notice there are four separate orange boxes, not one shared one. That separateness is the whole point: trace the magenta arrow and you'll see the same address copied into two different orange caches at once. All of them connect down to the single navy bar — the shared main memory.


2. Memory blocks, addresses, and the symbols , , ,

The parent note writes things like "block at address ". Let's earn every letter.

Recall

What does one block represent, physically? ::: A fixed-size chunk of memory (e.g. 64 bytes) that caches move and track as a single unit. How do you get block number from byte address ? ::: — divide by the block size and round down; the remainder (offset) is discarded. In , what is the counting? ::: One bit for each of the cores — the sharer bit-vector.


3. State: the words Uncached, Shared, Modified — and the "" bits

Every copy of a block is in some state. The parent uses three. Think of a block as a shared library book.

In figure s03 the three coloured boxes are the three states side by side; read the small navy caption under each to see what it says about main memory (valid vs. stale).


4. Sharers, the bit-vector, and the symbol

In figure s04, each square is one core's bit; the magenta squares are 1 (has a copy) and the pale ones are 0. Count the magenta squares — that's the size of the sharers set. The caption reads off which cores those are.


5. The Home node / Home Directory (HD)


6. Snooping, messages, hops, and O(N) vs O(N²)

The protocol works by cores mailing each other. Let's name the mail and the counting — but first the old approach directories replace.


7. Invalidate, Ack, and Write-Back


The prerequisite map

Core

Private cache

Same block in many caches

Address A byte

Block number B floor divide

Coherence problem

State Uncached Shared Modified 2 bits

Sharers bit-vector N bits

Directory entry

Home node HD

Messages and hops

Snooping O of N squared vs Directory O of N

Directory-based coherence

Read it top-down: cores with private caches create duplicate copies (the problem); state (2 bits) + sharers ( bits) describe each copy; the home directory stores those in an entry; messages act on entries; the traffic count (snooping vs directory) justifies the whole design.


Equipment checklist

Cover the right side and answer aloud. If you can, you're ready for the parent note.

What is a core, and why does each having its own cache create a problem?
A core is an independent instruction-runner; because each has a private cache, one address can live in several caches at once and their copies can disagree.
How do you turn a byte address into a block number ?
— divide by the block size and round down; the leftover offset bits are discarded.
Why does the state field cost exactly 2 bits?
Three states (Uncached/Shared/Modified) need at least 2 bits, since 1 bit gives only 2 patterns and 2 bits give 4 (three used, one spare).
What does a directory entry hold when the block is Uncached?
State bits and the sharer bit-vector is all zeros — nobody holds a copy.
In a bit-vector 0101 for 4 cores, who holds copies?
Cores 0 and 2 (rightmost bit = core 0).
What does mean?
A directory entry: a paired bundle of the block's state and either its single owner (Modified) or its set of sharers (Shared).
What is snooping, and how does it differ from a directory?
Snooping is broadcast coherence where all cores listen to a shared bus and every miss is heard by everyone; a directory instead records who has each block and messages only them.
What is the home node (HD) and why is it needed?
The fixed place that stores a given address's directory row — a known desk every core can ask "who has this block?"
Why is broadcast but directory ?
Broadcast: each of cores messages all others → ~, every time. Directory: each request goes to 1 home + a few sharers (avg 1–3) → grows with .
Why does the directory count Invalidate-Acks before granting a write?
To guarantee every old reader has killed its copy first, so no two caches hold different values for one address.