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 begins as follows:
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. What is the total size of the tags in the cache directory, in Kbits?
Explanation
Cache = 64KB / 16B per block = 4096 blocks total. 2-way associative → 4096/2 = 2048 sets, needing 11 set-index bits. Block offset needs log2(16)=4 bits. Since the cache uses 32-bit virtual addresses, TAG = 32-11-4 = 17 bits per line. Total tag storage = 4096 lines × 17 bits = 69632 bits = 68 Kbits (since 68×1024=69632 exactly).
Source: GATE CS 2008 (2008)
This question is part of a 15-day revision cycle — sign in and Project Forge will bring it back the day before you'd forget it.