5.4.10 · HinglishMemory Hierarchy & Caches

Average memory access time (AMAT)

1,623 words7 min readRead in English

5.4.10 · Hardware › Memory Hierarchy & Caches


AMAT KYA hai?


YEH EXACT FORMULA KYUN? (Scratch se derivation)

Hum chahte hain expected time per access. Ek single access le:

  • agar yeh hit kare (probability , jahan = miss rate),
  • kuch zyaada agar yeh miss kare (probability ).

Key modeling decision: Har access par hum pehle cache mein dekhte hain — toh hum hamesha pay karte hain. Sirf jab miss hota hai tab hum lower memory ka extra trip pay karte hain, .

Toh do outcomes hain:

Outcome Probability Time
Hit
Miss

Expected value (average ki definition):

Expand karo aur terms collect karo:


Recursive / Multi-level AMAT (caches kyun layered hote hain)

L1 ki "miss penalty" khud L2 ka AMAT hai. Memory ek hierarchy hai, isliye hum formula ko nest karte hain:

jahan main memory (ya next level) tak pahunchne ka time hai.


Figure — Average memory access time (AMAT)

Worked Examples


Common Mistakes


Active Recall

Recall Cover karo aur answer do
  1. AMAT formula batao aur kyun ko miss rate se multiply nahi kiya jaata.
  2. Do-outcome expected value se AMAT derive karo.
  3. DRAM abhi bhi slow hone ke bawajood L2 add karne se AMAT kyun reduce hoti hai?
  4. Local aur global miss rate mein kya fark hai?
  5. Example 1 mein AMAT ka kitna fraction misses se aaya?
Recall Feynman: ek 12-saal ke bacche ko explain karo

Socho tumhara school locker (fast) zyaadatar books hold karta hai. Zyaadatar baar tum instantly ek book uthate ho — yeh ek hit hai. Lekin kabhi-kabhi book door ki library mein hoti hai (slow) — yeh ek miss hai. Average mein, ek book lene mein kitna time lagta hai? Almost hamesha fast, lekin rare library trips itni slow hoti hain ki woh average ko upar khench deti hain. AMAT bas wahi average waiting time hai. Use chhota karne ke liye hum locker ko faster banane ki koshish nahi karte — hum library trips ko rarer banane ki koshish karte hain (fewer misses) ya ek nearby "shelf" (L2) add karte hain taaki hum rarely library tak jaayein.


Flashcards

AMAT formula (single level)
Hit time ko miss rate se kyun multiply nahi kiya jaata?
Aap har request par cache access karte ho, toh aap hamesha pay karte ho; sirf miss penalty miss hone par conditional hai.
Expected value se AMAT derive karo
Two-level AMAT formula
L2 ka local miss rate
L2 misses ÷ accesses jo L2 tak pahunche.
L2 ka global miss rate
L2 misses ÷ saare CPU accesses .
Recursive AMAT term ke andar kaun sa miss rate jaata hai?
Us level ka local miss rate.
Miss penalty ki definition
Hit access se aage next level se block fetch karne ka extra time.
Single-level: HT=1ns, m=5%, MP=100ns → AMAT?
ns.
L2 cache kyun add karo agar DRAM abhi bhi slow hai?
L1 misses mostly L2 mein hit hoti hain, toh huge DRAM penalty tiny product se multiply hoti hai.

Connections

  • Cache Miss Rate & Miss Types (3 Cs)
  • Miss Penalty & Main Memory Latency
  • Multi-level Cache Hierarchy
  • Cache Associativity & Hit Time tradeoff
  • CPU Performance Equation (AMAT memory-stall cycles mein feed hoti hai)
  • Locality of Reference (hit rates high kyun hoti hain)

Concept Map

derives

paid every access

gates penalty

extra fetch cost

defines

becomes

nests into

uses

times m of L1 gives

reduces expensive DRAM trips

AMAT expected access time

Hit Time

Miss Rate m

Miss Penalty

AMAT = HitTime + m x MP

Expected value over hit and miss

L2 AMAT as L1 penalty

Multi-level recursive AMAT

Local miss rate

Global miss rate