COMPUTER ORGANIZATION & ARCHITECTURE/Student Engineering Notebook
Page 06·notes
MEMORY HIERARCHY, CACHE MAPPING & AMAT—~28 MIN READ

Cache Replacement, Write Policies & Memory Interleaving

“Write-through vs write-back, write allocate, LRU stacks, and memory interleaving math.”

1.Cache Write Policies: Write-Through vs Write-Back

When the CPU writes data to memory, cache and main memory must maintain consistency:

1. Write-Hit Policies:

- Write-Through: Every write to the cache is simultaneously propagated to main memory. Main memory is always up to date. Requires a Write Buffer to avoid CPU stalling during slow RAM writes.

- Write-Back (Copy-Back): Data is written only to the cache line. The block is written back to main memory ONLY when it is evicted. Requires a Dirty Bit (Modified Bit) per cache line to track if the line was modified.

2. Write-Miss Policies:

- Write-Allocate (Fetch on Write): The block is loaded into the cache from main memory on a write miss, followed by the write hit operation. Usually paired with Write-Back.

- No-Write-Allocate (Write Around): The block is modified directly in main memory without loading it into the cache. Usually paired with Write-Through.

3. Main Memory Interleaving:

Divides physical memory into m independent banks to achieve concurrent memory accesses:

- High-Order Interleaving: Most significant bits select the memory bank; lower bits select the word within the bank. Does NOT provide parallelism for sequential array accesses.

- Low-Order Interleaving: Least significant bits select the memory bank (Bank = Address \bmod m). Consecutive addresses fall into consecutive memory banks! Allows pipelined access of m consecutive words in time T + (m - 1) × t_{bus}.

WORKED EXAM ANALYSIS · STEP-BY-STEP DERIVATION2 Marks

2. GATE Worked Numerical: Low-Order Memory Interleaving Latency

⚠️ Pitfall Warning:

Consecutive memory requests to low-order interleaved banks overlap in parallel. The time to read m consecutive words is NOT m * T_cycle, but T_access + (m - 1) * T_bus!

Problem: A main memory system has 8 memory banks organized with low-order interleaving. Each bank has a memory cycle time of 80 ns. The bus transfer time per word is 10 ns. Find:

1. Time to read 8 consecutive words without interleaving (single bank).

2. Time to read 8 consecutive words with 8-way low-order interleaving.

3. Speedup achieved by interleaving.

Step 1: Without interleaving:

Each word requires a full memory cycle of 80 ns.

T_{non-interleaved} = 8 × 80 ns = 640 ns.

Step 2: With 8-way low-order interleaving:

All 8 banks initiate their reads simultaneously at cycle 0.

The first word is ready at T = 80 ns and transferred on the bus (takes 10 ns).

Subsequent words are transferred over the bus every 10 ns because their memory accesses already completed in parallel.

T_{interleaved} = 80 ns + (8 - 1) × 10 ns = 80 + 70 = 150 ns.

Step 3: Speedup:

S = \frac{640 ns}{150 ns} \approx 4.27×.

SOURCE TRANSPARENCY & CITATIONS

Primary Academic References & Exam Sources

Every concept in Notes From a B.Tech Brain is synthesized from authoritative academic texts, seminal peer-reviewed research, verified exam archives, and renowned university lectures.

Curated University Lecture Series
Computer System Architecture (3rd Edition) ·
LECTURE SERIES
RECOMMENDED YOUTUBE EDUCATORS & FULL-COURSE PLAYLISTS

Curated for clarity, rigorous numerical solving, and semester excellence:

Gate Smashers · COA Full Course↗Instructor: Varun Singla · Covers: Instruction cycle, addressing modes, cache mapping, pipelining, I/O

Rapid GATE-focused conceptual coverage with numericals.

Open YouTube↗
Knowledge Gate · COA for GATE↗Instructor: Sanchit Jain · Covers: Cache bit-splitting, AMAT, pipeline CPI, IEEE 754, DMA

Past-paper-focused approach with clear COA numerical explanations.

Open YouTube↗
ETH Zürich · Digital Design & Computer Architecture↗Instructor: Prof. Onur Mutlu · Covers: Microarchitecture, pipelining, out-of-order execution, memory hierarchy

Graduate-level depth on how real modern processors are designed.

Open YouTube↗