IAE Academy

GATE 2020 CS Q.21: solution and answer

GATE 2020 · CSQ.21 · 1 mark · NAT

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 ____.

See the question in the paper

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)

  1. Word size = 64 bits = 8 bytes. Words per block = block size / word size = 256 bytes / 8 bytes = 32 words.

  2. 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}.

  3. Miss rate = 1 - hit rate = 1 - 0.94 = 0.06.

  4. 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