Consider a machine with a 2-way set associative data cache of size 64 Kbytes…
2008
Consider a machine with a 2-way set associative data cache of size 64 Kbytes and block size 16 bytes. The cache is managed using 32 bit virtual addresses and the page size is 4 Kbytes. A program to be run on this machine begins as follows:
C
double ARR[1024][1024];
int i, j;
// Initialize array ARR to 0.0
for(i = 0; i < 1024; i++)
for(j = 0; j < 1024; j++)
ARR[i][j] = 0.0;
The size of double is 8 Bytes. Array ARR is located in memory starting at the beginning of virtual page 0xFF000 and stored in row major order. The cache is initially empty and no pre-fetching is done. The only data memory references made by the program are those to array ARR. The total size of the tags in the cache directory is
Answer: D. 68 Kbits — Answer: 68 Kbits Compute the cache tag size step by step: Block offset: log2(block size) = log2(16 bytes) = 4 bits. Number of sets: (cache size) /…
- A.
32 Kbits
- B.
34 Kbits
- C.
64 Kbits
- D.
68 Kbits
Attempted by 83 students.
Show answer & explanation
Correct answer: D
Answer: 68 Kbits
Compute the cache tag size step by step:
Block offset: log2(block size) = log2(16 bytes) = 4 bits.
Number of sets: (cache size) / (associativity * block size) = 64 KB / (2 * 16 B) = 2048 sets, so index bits = log2(2048) = 11 bits.
Tag bits per cache line: virtual address width (32) - index bits (11) - block offset (4) = 17 bits.
Total number of cache lines: sets * ways = 2048 * 2 = 4096 lines.
Total tag bits = tag bits per line * number of lines = 17 * 4096 = 69632 bits = 68 Kbits.
Note: The question asks for the size of the tags in the cache directory, so this calculation counts tag bits only and does not include valid or replacement bits.