AMBA CHI · Module 19 · CHI Interview Mastery
Directory Role Question
The directory-role question asks why the directory exists and what it stores; be precise on both halves. What it stores: for each tracked line, which caches hold it — a sharer set — and its coherence state. It is metadata, not data — who has the line and its state, never the bytes. Why it exists: to turn broadcast snooping into targeted snooping. Without it, every coherence action snoops every cache, so traffic grows with node count; with it, the home snoops only the sharers, so traffic grows with sharing, not cores. That order-N to order-sharers reduction is why the protocol scales. The traps: saying it stores data, and dismissing it as an optimization. Representative interview guidance, not the specification.
Intermediate12 min readAMBA CHIInterviewDirectorySnoop FilterScalability
Module 19 · Chapter 19.4 · CHI Interview Mastery
Project thread — 19.3 established the home as the authority. 19.4 explains its directory; 19.5 walks an ownership transfer.
1. The Question
"Why does the directory exist, and what does it store?" — or: "What's the role of the directory in CHI?" "How does CHI avoid broadcasting snoops?" "What's in a directory entry?" It is a core intermediate question that tests whether you understand the single mechanism that makes CHI's coherence scalable.
2. What the Interviewer Is Probing
This question checks whether you understand both halves — the what (contents) and the why (purpose) — and, crucially, the connection between them. The interviewer wants:
- Do you know it stores metadata, not data? — the most common confusion.
- Can you name the contents precisely? — the sharer set and the coherence state.
- Do you know why it exists? — to replace broadcast snooping with targeted snooping.
- Do you connect it to scalability? — O(N) → O(sharers) is the whole point.
A candidate who says "the directory stores the cached data" or treats it as "just an optimization" reveals they miss that the directory is the load-bearing mechanism of a scalable coherence protocol.
3. Key Terms
4. Where This Sits in the Interview
This is the fourth rung — the mechanism behind the home's authority (19.3). It is the hinge of the coherence half of the interview: ownership transfer (19.5), ReadUnique flows (19.6), and the large-SoC scalability question (19.10) all rely on the directory targeting snoops. A crisp directory answer earns you those harder questions; a muddled one (data vs metadata confusion) undermines every flow that follows.
It is the natural elaboration of 19.1's scalability claim and 19.3's authority claim: the reason the home can scale coherence, and the reason it is the tracking authority, is the directory. This is where you cash in the scalability story you've been referencing — by naming the concrete mechanism.
5. The Core Answer
The what and the why, precisely:
"The directory stores, for each line the home tracks, which caches hold it — a sharer set — and its coherence state. It's metadata, not data. It exists to turn broadcast snooping into targeted snooping: instead of asking every cache, the home reads the sharer set and snoops only the caches that hold the line — which is what makes coherence scale."
The two halves:
- What it stores. Per line: the sharer set (which caches hold it — a bit-vector or list) and the coherence state. Metadata — who has it and in what state — never the bytes.
- Why it exists. Without a directory, every coherence action broadcasts a snoop to all caches — O(N) messages. With it, the home snoops only the sharers — O(sharers), typically one or two. That O(N) → O(sharers) reduction is the primary scalability lever.
The synthesis:
The directory stores metadata — the sharer set and coherence state per line, not the data. It exists to convert broadcast snooping (ask all N caches) into targeted snooping (ask only the sharers), so coherence cost grows with sharing, not node count. That reduction is the reason a directory protocol scales where broadcast snooping cannot.
6. Structuring Your Answer
The template:
- 1. What it stores, in one line. "Which caches hold each line, and the line's state — metadata, not data." Answer the concrete half first.
- 2. The metadata correction. "Not the bytes — those live in the caches and memory." Pre-empt the classic confusion.
- 3. Why it exists. "To replace broadcast snooping with targeted snooping." The purpose.
- 4. The scalability payoff. "O(N) → O(sharers) — coherence cost tracks sharing, not core count." Land on the point.
The point to carry:
Answer both halves and connect them: the contents (sharer set) enable the purpose (targeted snoops). A candidate who lists the contents but not the purpose sounds like they memorized a data structure; one who gives the purpose but not the contents sounds vague. The strong answer shows the sharer set is what makes targeting possible — content and purpose as cause and effect.
7. The Answer Skeleton
The two-half structure, ready to deliver.
| Half | Content | One line |
|---|---|---|
| What (contents) | sharer set + coherence state | "Which caches hold the line, and its state." |
| What (correction) | metadata, not data | "Not the bytes — those are in the caches/memory." |
| Why (purpose) | broadcast → targeted | "Snoop only the sharers, not everyone." |
| Why (payoff) | O(N) → O(sharers) | "Coherence cost tracks sharing, not core count." |
| The link | contents enable purpose | "The sharer set is what lets snoops be targeted." |
The rule to carry: the payoff row is the punchline. "O(N) → O(sharers)" is the single most compelling thing you can say — it is quantitative, it connects to scalability (19.1), and it explains why the directory is not optional but essential. Lead with contents, land on the payoff.
8. The Model Answer
A full, polished answer:
"The directory is the home node's record of who holds what. For each line the home tracks, it stores which caches hold that line — a sharer set, often a bit-vector — and the line's coherence state. The key thing is that it's metadata, not data: it records who has the line and in what state, never the actual bytes, which live in the caches and in memory.
Why does it exist? To turn broadcast snooping into targeted snooping. Without a directory, every time a line is written or taken exclusive, the home has to snoop every cache to find who might hold it — so snoop traffic grows with the node count, and coherence falls apart beyond a handful of cores.
With a directory, the home just reads the sharer set and snoops only the caches that actually hold the line — typically one or two. So snoop traffic grows with sharing, not with core count — that order-N to order-sharers reduction is the whole reason a directory protocol like CHI scales where broadcast snooping can't."
That is the contents (sharer set + state), the metadata correction, the purpose (targeted snooping), and the scalability payoff — with the contents explaining the purpose. The interviewer hears both what and why, connected.
9. The Depth Ladder
Matching depth.
- Junior signal. "The directory keeps track of the caches." — vague; no data-vs-metadata, no purpose.
- Mid signal. Adds contents and purpose — "it stores the sharer set and state, so the home can snoop only the sharers." Shows the mechanism.
- Senior signal. Adds the scaling math — "it's O(N) → O(sharers); most lines are shared by one or two caches, so targeting eliminates the vast majority of snoop traffic." Quantifies the win.
- Staff signal. Adds the trade-off and encoding — "the cost is directory storage — a few bits per line, and you choose bit-vector for precision or coarse-grained for area; and the directory must cover the cache footprint or it degrades to broadcasts. It's a storage-for-bandwidth trade that wins decisively at scale." Shows design judgment.
The point to carry:
Climb by quantifying (O(N) → O(sharers)) and then naming the trade-off (storage for bandwidth) and the failure mode (an undersized directory degrades to broadcasts). That path — from "it targets snoops" to "it trades a few bits of storage for order-N bandwidth, and must cover the caches to keep the win" — is the arc from mid to staff, and it connects to directory efficiency (Chapter 15.5).
10. A Concrete Example
The grounding example:
"Concretely: a 64-core chip, a line shared by 2 cores. A write to that line: broadcast protocol snoops all 64 caches — 64 messages, 62 of them useless 'I don't have it' replies. Directory protocol reads the sharer set — 2 bits set — and snoops exactly 2 caches. That's 2 messages instead of 64, a 32× reduction, on every coherence action to that line. Scale that across the whole workload and it's the difference between coherence traffic that explodes and traffic that stays flat. That's the directory earning its keep."
A 64-core, 2-sharer example makes the O(N) → O(sharers) win visceral — 2 messages instead of 64 — which lands far harder than the abstract statement.
11. Mental Map
The recall structure — two halves and a link.
- What: sharer set + state → "who holds each line, and how." Metadata, not data.
- Why: broadcast → targeted → "snoop only the sharers."
- Payoff: O(N) → O(sharers) → "cost tracks sharing, not cores."
- Link: the sharer set is what makes targeting possible.
The rule to carry: hold it as what-enables-why. The sharer set (what) is the thing that allows targeted snoops (why), and the payoff is the scaling. If asked only "what," give the contents and the reason they matter; if asked only "why," give the purpose and the contents that enable it. Content and purpose travel together.
12. What a Strong Answer Includes
The rubric.
| Element | Strong answer? | Why |
|---|---|---|
| Contents: sharer set + state | yes | the concrete "what" |
| Metadata, not data | yes | the key correction |
| Purpose: broadcast → targeted | yes | the "why" |
| O(N) → O(sharers) | yes | the quantitative payoff |
| Connects to scalability | yes | the senior signal |
| Trade-off (storage) / coverage | bonus | staff-level nuance |
The rule to carry: the metadata-not-data point and the O(N)→O(sharers) payoff are the two must-haves. The first proves you understand what a directory is (a snoop filter, not a data store); the second proves you understand why it matters (scalability). Include both and the answer is strong; miss either and it's incomplete.
13. Weak Answer vs Strong Answer
Same knowledge, two deliveries.
- Weak: "The directory stores the cache lines so the home knows the data. It's an optimization to make coherence faster." — stores data (wrong) and "just an optimization" (understates it) — two errors that miss the mechanism.
- Strong: "It stores metadata — which caches hold each line and its state, not the data. It exists to snoop only the sharers instead of broadcasting to everyone — O(N) to O(sharers) — which is what makes coherence scale." — contents, metadata correction, purpose, payoff.
The difference is metadata-not-data and scaling-not-optimization: the weak answer treats the directory as a data cache and a nice-to-have; the strong answer identifies it as a snoop filter and the load-bearing scalability mechanism.
14. The Interview Trap
15. Common Mistakes
- Stores the data. Assumption: directory holds lines. Trap: it's a data store. Fix: metadata — sharer set + state.
- "Just an optimization." Assumption: nice-to-have. Trap: understates it. Fix: the scalability mechanism.
- Contents without purpose. Assumption: list the fields. Trap: sounds like a data structure. Fix: connect to targeted snoops.
- Purpose without contents. Assumption: "it targets snoops." Trap: vague. Fix: name the sharer set.
- No scaling math. Assumption: "it's faster." Trap: not quantitative. Fix: O(N) → O(sharers).
- Ignoring coverage. Assumption: it always works. Trap: an undersized directory broadcasts. Fix: it must cover the cache footprint (when asked).
16. Interview Checklist
- State the contents — sharer set + coherence state, per line.
- Say metadata, not data — never the bytes.
- Give the purpose — broadcast → targeted snooping.
- Deliver the payoff — O(N) → O(sharers), cost tracks sharing.
- Connect to scalability — why CHI scales where broadcast can't.
- Note the storage trade-off / coverage only if depth is wanted.
17. Key Takeaways
- The directory stores metadata — the sharer set and coherence state per line, not data.
- It exists to turn broadcast snooping into targeted snooping.
- The payoff is O(N) → O(sharers) — coherence cost tracks sharing, not core count.
- That reduction is the reason a directory protocol scales.
- It is a snoop filter, not a data store, and not "just an optimization."
- Give both the contents and the purpose; the guidance here is representative.
18. Quick Revision
Directory role. (capsule answer.) "The directory is the home node's record of who holds what. For each line the home tracks, it stores which caches hold that line — a sharer set, often a bit-vector — and the line's coherence state. It stores metadata, not data: who has the line and in what state, never the bytes, which live in the caches and in memory. It exists to turn broadcast snooping into targeted snooping — without it, every coherence action must snoop every cache (O(N)), so traffic grows with node count and coherence collapses past a few cores; with it, the home reads the sharer set and snoops only the sharers (O(sharers), usually one or two), so traffic grows with sharing, not core count. That order-N to order-sharers reduction is the reason a directory protocol like CHI scales where broadcast snooping cannot. (The cost is a few bits of directory storage per line, and the directory must cover the cache footprint or it degrades to broadcasts — a storage-for-bandwidth trade that wins decisively at scale.)" Give both halves — contents and purpose — and land on O(N) → O(sharers). The traps: it stores data (no — metadata), and it's "just an optimization" (no — the scalability mechanism). Representative interview guidance; 19.5 walks an ownership transfer.
Coming Next
Chapter 19.5 — Ownership Transfer Question. The directory tracks who owns a line; the next question asks you to walk a transfer of that ownership. Chapter 19.5 covers the ownership-transfer question — narrating, step by step, how a dirty line moves from one request node to another through the home, why the data and the write-back obligation travel together, and the sequence an interviewer expects you to draw.