GATE Computer ScienceVery hardGATE CSE
A 4 KB direct-mapped cache has 32-byte lines. The loop "for i = 0..127: sum += A[i] + B[i]" reads 4-byte integers, A starting at address 0 and B starting at address 4112 (= 4096 + 16), A[i] read before B[i]. Counting hits over all 256 reads (cache initially empty), how many hits occur?
- A. 96
- B. 0
- C. 128
- D. 192
Correct answer: A. 96
B is offset by half a line from a 4 KB multiple: for i mod 8 < 4, A[i] and B[i] map to the same set and evict each other, otherwise they use different sets; simulation gives 96 hits (if B started at 4096 every access would miss: 0 hits).
Practise more Computer Organization and Architecture questionsComputer Organization and Architecture: notes and key points
More Computer Organization and Architecture questions
- A RISC ISA has fixed 4-byte instructions. A conditional branch holds a 16-bit signed offset counted in instructions and the target is…
- How many distinct single-precision IEEE 754 values x satisfy 1 ≤ x < 1024?
- A disk spins at 7200 rpm, has an 8 ms average seek and a 100 MB/s media rate (1 KB = 1000 B, 1 MB = 10⁶ B). Request X reads one contiguous…
- A memory has 8 low-order interleaved banks (bank = word address mod 8). An access started in cycle t keeps its bank busy in cycles t … t+5…
- A classic 5-stage pipeline (IF, ID, EX, MEM, WB) has no forwarding; the register file is written in the first half of a cycle and read in…
- A pipeline has a two-slot delayed branch: the two instructions after every branch always execute. The compiler fills the first slot with a…