GATE / CS ARCHIVE

GATE CSE 2007 / QUESTION 80

Cache misses across two array scans

Computer Organization & Architecture · Cache Memory · Full GATE CSE 2007 paper

GATE 2007, Q80 2 marks · MCQ
Report issue

Cache Memory

Question 80, GATE 2007: Main memory is byte-addressable with 2^16 bytes. A direct-mapped data cache has 32 lines, 64 bytes each, and starts empty. A 50×50 array of bytes is contiguous starting at hexadecimal address 1100H. The complete array is accessed twice, with no intervening changes to cache contents. The source does not specify traversal order; use increasing-address scans for the intended result. How many total data-cache misses occur?
Options:
(A) 48
(B) 50
(C) 56
(D) 59
Question 80, GATE 2007: Main memory is byte-addressable with 2^16 bytes. A direct-mapped data cache has 32 lines, 64 bytes each, and starts empty. A 50×50 array of bytes is contiguous starting at hexadecimal address 1100H. The complete array is accessed twice, with no intervening changes to cache contents. The source does not specify traversal order; use increasing-address scans for the intended result. How many total data-cache misses occur?
Options:
(A) 48
(B) 50
(C) 56
(D) 59
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. Approach. Convert the starting address to a block number and count all touched blocks, including the partial final block. For the second scan, identify conflicts modulo the 32 cache lines instead of treating all 40 blocks as compulsory misses again.

2. Derivation and interpretation. Assuming each complete pass reads the array in increasing memory-address order, the 2500-byte array begins at 0x1100=4352, a 64-byte boundary. It spans ceil(2500/64)=40 blocks, numbered 68 through 107. The cold first pass misses 40 times. In the 32-line direct-mapped cache, blocks 68–75 and 100–107 compete for lines 4–11. In the second pass, loading 68–75 evicts 100–107, so both groups miss again, while the other 24 blocks hit. Total 40+8+8=56, option C. Merely saying the complete array is accessed does not specify traversal order; different orders can produce different miss counts.

Original paper, page 20