5.4.14 · D3 · HinglishMemory Hierarchy & Caches

Worked examplesCache coherence problem

3,059 words14 min read↑ Read in English

5.4.14 · D3 · Hardware › Memory Hierarchy & Caches › Cache coherence problem

Tumne coherence ka problem parent note Cache coherence problem mein dekha hai. Wahaan tumne ek failure table aur teen example sketches dekhe the. Yeh page sketching ka ulta karta hai: yeh har tarah ki situation list karta hai jo coherence problem tumhare saamne rakh sakti hai, phir har ek ko last message count tak work out karta hai — taaki koi bhi case aisa na rahe jo tumne pehle na dekha ho.

Shuru karne se pehle, vocabulary dobara seedhi kar lete hain taaki koi bhi symbol bina explanation ke andar na ghus aaye.

Neeche sab kuch bas yahi words hain jo alag-alag starting conditions par apply hote hain.


Scenario matrix

Coherence ke outcomes depend karte hain line kiske paas hai, kya operation ho raha hai, kaunsa protocol coherence enforce karta hai, aur memory kab refresh hoti hai (write-through vs write-back). Yeh hai us case-classes ka poora grid jo yeh topic produce kar sakta hai:

# Case class Jis variable par stress hai Covered by
C1 Single writer, doosri caches stale, koi protocol nahi baseline bug Ex 1
C2 Write-invalidate coherence restore karta hai invalidate ka ilaaj Ex 2
C3 Write-update coherence restore karta hai update ka ilaaj Ex 3
C4 Repeated writes, ek writer (invalidate favoured) write-run length Ex 4
C5 Producer/consumer, har write ke baad read (update favoured) sharing tightness Ex 5
C6 Write-through vs write-back: kya memory correct hai? memory kab refresh hoti hai Ex 6
C7 Degenerate: sirf ek core line cache karta hai (koi sharer nahi) zero other copies Ex 7
C8 Degenerate: dono cores sirf read karte hain, koi nahi likhta zero writes Ex 8
C9 Limiting case: N sharers, ek write — traffic kaisa scale karta hai N ke saath scaling Ex 9
C10 Real-world word problem + exam twist (false sharing) alag addresses, same line Ex 10

Matrix ko aise padho: rows C1–C3 teen protocol behaviours hain; C4–C5 batate hain kab kaunsa protocol jeetta hai; C6 memory-freshness axis ko isolate karta hai; C7–C8 degenerate (kuch fix nahi karna) cases hain; C9 sharer count ko limit tak push karta hai; C10 woh sneaky wala hai.

Poore note mein base scenario hai: variable X memory mein 5 se shuru hota hai, cores hain Core A aur Core B (plus zyada jab stated ho), caches write-back hain jab tak row kuch aur na kahe.


Worked examples


Scaling picture

Figure — Cache coherence problem

Figure ek write ke liye coherence traffic plot karta hai jaise sharers ki sankhya badhti hai (Example 9). Pale-yellow flat line write-invalidate hai (hamesha 1 broadcast). Chalk-pink rising line write-update hai ( point-to-point messages). Dekho kahan yeh cross karte hain: par dono tie karte hain (1 each); uske baad, update haarta hai, aur tak yeh 63× zyada cost karta hai. Wahi crossing poora argument hai ki real CPUs invalidate-based kyun hote hain.


Recall

Connections