S4 · Lesson 33 · Directories and interconnection networks
Directory-based coherence, its storage cost, message hops, and network topologies
Snooping needs every cache to see every miss, which a single bus can provide for a few dozen cores at most. Larger machines replace the broadcast with a directory: for every memory line, a home node records which caches hold it, so a miss sends messages only to the caches that matter. The messages travel over a network of point-to-point links, a mesh on a chip or a fat tree across a data center, and its shape decides how far a message must go and how much traffic can cross the machine at once. Directories trade broadcast bandwidth for storage and extra hops.
- Network diameter, the most hops between any two nodes, against the number of nodes N, for a ring (), a 2D mesh (), a 2D torus (about ) and a hypercube ().
- The ring is cheap but its diameter grows linearly; the mesh and torus fit flat chips; the hypercube grows slowly but needs links per node.
- The readouts give bisection width, the links cut when the machine is split in half, for M nodes: the bandwidth for traffic that crosses the middle.
Predict
A full bit-vector directory keeps one presence bit per core for every 64-byte line. With 64 cores, how big is the directory compared to the data?
12.5%: 64 bits for every 512 bits of data. With 1024 cores it would be 1024 bits per line, twice the data itself. Large machines therefore use limited-pointer directories (a few core numbers per line, overflowing to broadcast or software), coarse vectors (a bit per group of cores) or sparse directories that track only lines actually cached.
Name it
Directory protocols
Each line has a home node holding its directory entry: a state (uncached, shared, exclusive) and a record of which caches hold it.
- Read miss, line clean at home: requester → home → requester: 2 messages.
- Read miss, line modified in another cache: requester → home → owner → requester (with a copy to home): 3 hops on the critical path.
- Write miss to a shared line: the home sends invalidations to each sharer and collects their acknowledgments.
Miss latency ≈ (critical-path messages) × (average hops × per-hop latency + per-message overhead).
Directory storage
- Full bit vector: N bits per line, an overhead of for B-byte lines.
- Limited pointers: p pointers of bits each.
Interconnection networks
| Topology (N nodes) | Diameter | Bisection links | Links per node |
|---|---|---|---|
| ring | N/2 | 2 | 2 |
| 2D mesh, k × k | k | up to 4 | |
| 2D torus, k × k (k even) | k | 2k | 4 |
| hypercube | N/2 |
On a k × k mesh the average distance between two distinct nodes is hops under uniform traffic. Bisection bandwidth = bisection links × link bandwidth caps all-to-all traffic.
Worked example
Compare an 8 × 8 mesh and an 8 × 8 torus: diameter, bisection and (for the mesh) average distance. With 3 ns per hop, what's the critical-path latency of a 3-hop miss on the mesh at average distance, ignoring overheads?
Show the solution
- Mesh. Diameter 14, bisection 8 links, and average distance
- Torus. Diameter 8, bisection 16 links.
- A 3-message miss on the mesh. It crosses about which at 3 ns per hop is 48 ns before memory or cache access times.
- Why placement matters. That's why placing data near the cores that use it matters on large chips.
Answer the mesh has diameter 14, bisection 8 links and an average distance of 5.33 hops; the torus has diameter 8 and bisection 16; the miss's critical path is about 48 ns.
Worked example
A 1024-core machine with 64-byte lines: what does a full bit vector cost, and what do 4 limited pointers cost?
Show the solution
- Full bit vector. 1024 bits per 512-bit line: overhead.
- Four pointers. Each is bits: which is 7.8% overhead.
- Overflow. Lines shared by more than four caches overflow, which is rare for most data but common for widely read code and constants, so systems handle overflow with a broadcast or a coarser vector.
Answer a full bit vector costs 200% of the line, and four limited pointers cost 40 bits, 7.8%.
Worked example
Compare a 64-node hypercube with an 8 × 8 mesh: diameter, bisection links and links per node.
Show the solution
- Hypercube. Diameter , bisection 32 links, and 6 links per node.
- Mesh. Diameter 14, bisection 8 links, up to 4 links per node, and an average distance of
- Trade-off. The hypercube has four times the bisection and much shorter paths, but its node degree grows with size, so large machines use meshes, tori or fat trees.
Answer the hypercube has diameter 6, 32 bisection links and 6 links per node; the mesh has diameter 14, 8 bisection links and up to 4 links per node.
Check
A full bit-vector directory tracks 64 cores for 32-byte lines. What's its storage overhead relative to the data?
Check
A limited-pointer directory keeps 2 pointers per line for 1024 cores. How many bits of pointers is that?
Check
What's the diameter of an 8 × 8 mesh?
Check
What's the average distance between two distinct nodes of an 8 × 8 mesh under uniform traffic?
Check
An 8 × 8 torus has links of 16 GB/s in each direction. What's its bisection bandwidth, counting one direction?
Check
A directory miss has 3 messages on its critical path, each crossing 3 hops of 5 ns and paying 20 ns of overhead at the end. What's the network part of its latency?
Write units the way you normally would: 1.5 ns, 1500 ps and 0.0015 µs are the same answer.
Check
Compare an 8 × 8 mesh and an 8 × 8 torus.
(a)
What is the mesh's diameter?
(b)
What is its average distance under uniform traffic?
(c)
What is the torus's bisection?
Check
A directory serves 256 cores with 64-byte lines.
(a)
What storage overhead does a full bit vector add?
(b)
How many bits do 8 limited pointers take?
Check
A miss's critical path has m messages, each crossing h hops at t per hop plus o of overhead.
Step 1
What is its latency?
Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.
Explain why
Why do large multiprocessors use directories instead of snooping?
Snooping works by broadcasting every miss to every cache, so each cache must examine every other core's misses, and the shared medium must carry all of them. As cores are added, broadcast traffic grows with the number of cores times their miss rate, and the bus or broadcast network saturates. A directory records, for each line, which caches actually hold it, so a miss is sent only to the home node and to the few caches that need to supply data or be invalidated. Traffic then grows with the actual sharing instead of the machine size, and messages can travel over a scalable point-to-point network. The costs are the directory storage and an extra hop through the home node on many misses.
Practice
Keep practicing
11 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.