6.1.6 · D1 · HinglishParallelism & Multicore

FoundationsCache coherence at scale (directory-based)

2,997 words14 min read↑ Read in English

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

Parent note Cache coherence at scale (directory-based) padhne se pehle, tumhe har woh word aur symbol samajhna hoga jo woh use karta hai. Hum har cheez ko zero se build karte hain — pehle picture, phir meaning, phir kyun is topic ko uski zaroorat hai.


1. Ek core, aur kyun uske paas private cache hai

Figure s01 mein, upar violet boxes follow karo — woh cores hain. Har ek ke neeche seedha uski khud ki orange cache hanging hai; notice karo ki char alag orange boxes hain, ek shared nahi. Woh alag-alag hona hi poora point hai: magenta arrow trace karo aur tum dekhoge ki same address ek saath do alag orange caches mein copy ho gayi hai. Sab neeche ek single navy bar — shared main memory — se connect hain.


2. Memory blocks, addresses, aur symbols , , ,

Parent note mein "block at address " jaisi cheezein likhi hain. Har letter earn karte hain.

Recall

Ek block physically kya represent karta hai? ::: Memory ka ek fixed-size chunk (e.g. 64 bytes) jise caches ek single unit ki tarah move aur track karte hain. Byte address se block number kaise milta hai? ::: — block size se divide karo aur round down karo; remainder (offset) discard ho jaata hai. mein, kya count kar raha hai? ::: cores mein se har ek ke liye ek bit — sharer bit-vector.


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

Ek block ki har copy kisi state mein hoti hai. Parent teen use karta hai. Block ko ek shared library book ki tarah socho.

Figure s03 mein teen coloured boxes teen states hain side by side; har ek ke neeche chhota navy caption padho jo main memory ke baare mein kya kehta hai (valid vs. stale).


4. Sharers, bit-vector, aur symbol

Figure s04 mein, har square ek core ka bit hai; magenta squares 1 hain (copy hai) aur pale ones 0 hain. Magenta squares count karo — woh sharers set ka size hai. Caption off karta hai ki woh cores kaun se hain.


5. Home node / Home Directory (HD)


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

Protocol cores ke ek doosre ko mail karne se kaam karta hai. Mail aur counting ko naam dete hain — lekin pehle woh purana approach jo directories replace karti hain.


7. Invalidate, Ack, aur Write-Back


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

Ise top-down padho: private caches wale cores duplicate copies create karte hain (problem); state (2 bits) + sharers ( bits) har copy describe karte hain; home directory unhe ek entry mein store karta hai; messages entries par act karte hain; traffic count (snooping vs directory) poore design ko justify karta hai.


Equipment checklist

Right side cover karo aur zor se answer karo. Agar kar sako, tum parent note ke liye ready ho.

Ek core kya hai, aur kyun har ek ka apna cache hona ek problem create karta hai?
Core ek independent instruction-runner hai; kyunki har ek ke paas private cache hai, ek address ek saath kai caches mein reh sakta hai aur unki copies disagree kar sakti hain.
Byte address ko block number mein kaise convert karo?
— block size se divide karo aur round down karo; bacha hua offset bits discard ho jaata hai.
State field exactly 2 bits kyun cost karti hai?
Teen states (Uncached/Shared/Modified) ke liye kam se kam 2 bits chahiye, kyunki 1 bit sirf 2 patterns deta hai aur 2 bits 4 dete hain (teen use, ek spare).
Block Uncached hone par directory entry kya hold karti hai?
State bits aur sharer bit-vector sab zeros hai — kisi ke paas copy nahi.
4 cores ke liye bit-vector 0101 mein, kis ke paas copies hain?
Cores 0 aur 2 (rightmost bit = core 0).
ka kya matlab hai?
Ek directory entry: block ki state aur ya toh uske single owner (Modified) ya uske sharers ke set (Shared) ka paired bundle.
Snooping kya hai, aur yeh directory se kaise differ karta hai?
Snooping broadcast coherence hai jahan sab cores ek shared bus sun te hain aur har miss sab ke paas jaata hai; directory ki jagah record karti hai kis ke paas kaun sa block hai aur sirf unhe message karta hai.
Home node (HD) kya hai aur iski zaroorat kyun hai?
Woh fixed jagah jo ek diye gaye address ki directory row store karti hai — ek jaana-pehchaana desk jisse har core poochh sake "is block ke paas kaun hai?"
Broadcast kyun hai lekin directory ?
Broadcast: cores mein se har ek baaki ko message karta hai → ~, har baar. Directory: har request 1 home + kuch sharers (avg 1–3) tak jaati hai → ke saath badhti hai.
Directory write grant karne se pehle Invalidate-Acks kyun count karta hai?
Guarantee karne ke liye ki har purane reader ne pehle apni copy maar di, taaki do caches ek address ke liye alag-alag values hold na karein.