6.1.6 · D3 · HinglishParallelism & Multicore

Worked examplesCache coherence at scale (directory-based)

3,061 words14 min read↑ Read in English

6.1.6 · D3 · Hardware › Parallelism & Multicore › Cache coherence at scale (directory-based)

Yeh page drill floor hai. Parent note ne tumhe bataya tha ki directory protocols kaise kaam karte hain; yahan hum machine ko har us situation se guzarte hain jo use mil sakti hai — har starting state, har degenerate corner, ek real word problem, aur ek exam trap — aur har ek ka arithmetic check karte hain.

Koi example touch karne se pehle, ek promise: hum koi bhi aisa symbol use nahi karenge jo tumne pehle nahi dekha. Aao hum teen cheezein phir se samjhein jo baar baar aati hain.


Scenario matrix

Har woh case jo ek directory protocol face kar sakta hai, woh (starting state) × (operation) ka combination hota hai, saath mein degenerate aur real-world corners. Yeh pura grid hai; har cell us example ka naam batati hai jo use cover karta hai.

# Starting state Operation Degenerate / twist Covered by
1 Uncached Read pehli baar touch (base case) Ex 1
2 Shared Read ek sharer add karo, koi data movement nahi Ex 2
3 Modified (other owner) Read owner ko write back karna hoga Ex 3
4 Shared (many sharers) Write sab invalidate + ack-count Ex 4
5 Modified (other owner) Write invalidate-forward, ownership transfer Ex 5
6 Shared, tum already hold kar rahe ho Write (upgrade) zero data transfer, self invalidate nahi Ex 6
7 koi bhi storage cost limiting cases (, bada ) Ex 7
8 koi bhi NUMA home routing address bits se (word problem) Ex 8
9 Shared Write exam twist: race — do writers ek saath Ex 9

Nau cells, nau examples. "Forecast:" line padho aur steps unfold karne se pehle guess karo.


Worked examples


Recall Quick self-test

Ex 3: Modified block par read ke time, data kaun supply karta hai — memory ya owner? ::: Owner (memory stale hoti hai write-back tak). Ex 4: HD ke paas 3 sharers ke saath Shared hai; ek write aati hai — use kitne Inv-Ack collect karne hain? ::: Saare 3, write grant karne se pehle. Ex 6: ek current sharer write ke liye upgrade karta hai — usse kitne bytes of data move hote hain? ::: Zero; uske paas already valid copy hai, toh sirf ack (koi payload nahi). Ex 7: full-map directory storage ki tarah badhti hai ya ki tarah? ::: Linear in (woh bit-vector), kabhi nahi. Ex 8: interleaving mein consecutive 256B blocks same socket ya alag sockets par land karte hain? ::: Alag sockets par, by design, load spread karne ke liye. Ex 9: do simultaneous writers ko dono block own karne se kaun rokta hai? ::: Home directory ek address ke liye requests serialize karta hai — ek arbiter, ek order.

See also: Cache coherence protocols (MESI, MOESI) · NUMA architectures · Interconnect topologies · Memory consistency models · Cache line false sharing · back to the parent topic.