A direct mapped cache memory of 1 MB has a block size of 256 bytes. The cache has an access time of 3 ns and a hit rate of 94%. During a cache miss, it takes 20 ns to bring the first word of a block from the main memory, while each subsequent word takes 5 ns. The word size is 64 bits. The average memory access time in ns (round off to 1 decimal place) is ____.
GATE 2020 CS Q.21: solution and answer
Answer and solution
ANSWER
The average memory access time (AMAT) is ns (rounded to 1 decimal place).
Official answer: 13.3, or 13.5Source: Official answer key, GATE 2020 CS (IIT Delhi)
Word size = 64 bits = 8 bytes. Words per block = block size / word size = 256 bytes / 8 bytes = 32 words.
On a miss, the first word costs 20 ns and each of the remaining 31 words costs 5 ns, so miss penalty = 20 + 31 \times 5 = 20 + 155 = 175 \text{ ns}.
Miss rate = 1 - hit rate = 1 - 0.94 = 0.06.
AMAT = hit time + miss rate \times miss penalty = 3 + 0.06 \times 175 = 3 + 10.5 = 13.5 \text{ ns}.
KEY IDEA
Average memory access time (AMAT) combines the cache's own access time with the extra time paid only on a miss: , where the miss penalty for a block transfer is (time for first word) + (words remaining) (time per subsequent word).
WATCH OUT FOR
Using the wrong word size to compute words per block (e.g. forgetting to convert 64 bits to 8 bytes), or forgetting to subtract 1 from the word count when computing the miss penalty (the first word already costs 20 ns, so only the remaining 31 words cost 5 ns each) — this pair of slips is exactly why the answer key accepts two nearby values.
From the GATE 2020 CS paper. Every question of this paper · Download the full paper · All 22 Memory & cache questions, with notes
More Memory & cache questions
- GATE 2018 CS Q.23 · NAT · 1 markA 32-bit wide main memory unit with a capacity of 1 GB is built using 256M × 4-bit DRAM chips.
- GATE 2018 CS Q.34 · MCQ · 2 marksThe size of the physical address space of a processor is 2^P bytes. The word length is 2^W bytes.
- GATE 2026 CS1 Q.38 · MCQ · 2 marksThe size of the physical address space of a processor is 2^32 bytes.
- GATE 2026 CS1 Q.54 · MSQ · 2 marksConsider a system that has a cache memory unit and a memory management unit (MMU).
