GATE / CS ARCHIVE

GATE CSE 2007 / QUESTION 81

Cache lines replaced on second scan

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

GATE 2007, Q81 2 marks · MCQ
Report issue

Cache Memory

Question 81, 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. Which cache lines are replaced by new blocks during the second access? Lines are numbered from zero.
Options:
(A) 4 through 11
(B) 4 through 12
(C) 0 through 7
(D) 0 through 8
Question 81, 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. Which cache lines are replaced by new blocks during the second access? Lines are numbered from zero.
Options:
(A) 4 through 11
(B) 4 through 12
(C) 0 through 7
(D) 0 through 8
Question 81, 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. Which cache lines are replaced by new blocks during the second access? Lines are numbered from zero.
Options:
(A) 4 through 11
(B) 4 through 12
(C) 0 through 7
(D) 0 through 8
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. Approach. Map each memory block to block_number mod 32. Forty sequential blocks exceed the cache by eight, so identify which eight line indices are used twice rather than assuming that replacements start at line zero.

2. Derivation and interpretation. With increasing-address scans as in Q80, the array occupies blocks 68–107. Modulo 32, the first eight blocks 68–75 and final eight 100–107 both map to cache lines 4–11. Only those lines are replaced in the second scan, first by 68–75 and later by 100–107. Answer A. Lines are numbered from zero; the result is conditional on the scan-order assumption omitted from the common statement.

Original paper, page 20