Back to the 2025 paper

Module 4: Memory Organization

20257m

Discuss memory hierarchy design principles. Explain how access time, cost, and size influence memory organization.

Worked SolutionAI Assisted

Memory Hierarchy Design Principles [7M]

Why hierarchy? No single technology gives simultaneously large capacity + low cost + high speed. Hierarchy combines multiple levels giving illusion of large fast cheap memory by exploiting locality of reference.

Levels (pyramid top=fast):

Registers (32-64 words, 0.5 ns, highest cost/bit)
   |
Cache L1/L2/L3 (SRAM, KB-MB, 1-10 ns)
   |
Main Memory (DRAM, GB, 50-70 ns)
   |
Secondary (SSD/HDD, TB, 0.1-10 ms)
   |
Tertiary (Tape/Cloud, PB, seconds)

Design Principles:

1. Inclusiveness & Locality:
Upper levels store subset (copy) of lower level working set. Temporal locality -> reuse in cache; spatial locality -> block size >1 word (cache line 64B, page 4KB, disk block 4KB). Hit ratio h≈0.95+h \approx 0.95+ needed for effectiveness.

2. Cost-Performance Tradeoff:
Cost/bit decreases downwards, Access time increases. Average cost/bit:
Cavg=∑CiSi∑Si C_{avg} = \frac{\sum C_i S_i}{\sum S_i}
Dominated by cheap large lower level, while average access time dominated by fast upper level if hh high:
Teff=h⋅TL1+(1−h)(TL1+TL2)≈hT1+(1−h)T2 T_{eff} = h \cdot T_{L1} + (1-h)(T_{L1}+T_{L2}) \approx h T_1 + (1-h)T_2
For memory hierarchy: Teff=h⋅5ns+(1−h)⋅70nsT_{eff}= h \cdot 5ns + (1-h)\cdot 70ns. With h=0.95h=0.95, Teff=8.25nsT_{eff}=8.25ns ~ Cache speed but capacity ~RAM.

3. Size vs Time vs Cost:

  • Faster -> Smaller (SRAM 6T cell area >> DRAM 1T, register file tiny)
  • Larger -> Slower (address decode delay, physical distance)
  • Cheaper -> Larger (DRAM 0.01/GB0.01/GB vs SRAM 1/GB1/GB). Hierarchy picks sweet spot at each point.

4. Block Replacement & Mapping:
Direct/associative mapping, write-through/write-back, LRU replacement, demand paging - all to approximate optimal (Belady) with minimal overhead.

5. Policies:

  • Access locality principle: 90/1090/10 rule.
  • Consistency: Write policies keep levels coherent.
  • VM: Page tables allow hierarchy to appear as linear address space.

Influence on Organization:

  • Cache size tradeoff: Too small -> low hit rate, too large -> slower hit time (increases T1T_1) and higher cost. Optimum ~32KB L1, 256KB L2.
  • Main memory sized to hold working sets of multiprogrammed processes: Size≫∑WiSize \gg \sum W_i to avoid thrashing.
  • Use interleaving/banking and wide buses to match bandwidth between levels (e.g. 64B cache line burst from DRAM).

Example: Evolution from 1980: No cache -> 1-level -> 3-level + TLB hierarchy improved effective CPI from ~10 to ~1 despite 100x gap between CPU and DRAM.

Conclusion: Hierarchy succeeds because Teff≈TfastT_{eff} \approx T_{fast} if locality holds, while Ceff≈CslowC_{eff} \approx C_{slow}, bridging technology gap.

Similar questions

Student FinanceWeb Platform

Pocketly — Personal Finance for Students

Keep your hostel and college expenses under control. Track accounts, log spending in seconds, and stay within your monthly budget.