Skip to content

GATE CS 2012 Q55 — Memory Hierarchy: Cache, Main Memory and Secondary Storage

Explain with AI

A computer has a 256256-KByte\text{KByte}, 4-way set associative, write back data cache with block size of 3232 Bytes\text{Bytes}. The processor sends 3232 bit\text{bit} addresses to the cache controller. Each cache tag directory entry contains, in addition to address tag, 22 valid bits, 11 modified bit and 11 replacement bit.

The size of the cache tag directory is:

Choose one option
View worked solution

Answer: A

To find the size of the cache tag directory, we need to calculate the number of blocks in the cache, the tag size for each block, and then the total bits required for all entries.

Step 1: Calculate the number of cache blocks (lines)

Total Blocks=Cache SizeBlock Size=256 KB32 Bytes=218 Bytes25 Bytes=213=8192 blocks\text{Total Blocks} = \frac{\text{Cache Size}}{\text{Block Size}} = \frac{256 \text{ KB}}{32 \text{ Bytes}} = \frac{2^{18} \text{ Bytes}}{2^5 \text{ Bytes}} = 2^{13} = 8192 \text{ blocks}

Step 2: Calculate the number of sets

Since the cache is 4-way set associative: Number of Sets=Total BlocksAssociativity=2134=211=2048 sets\text{Number of Sets} = \frac{\text{Total Blocks}}{\text{Associativity}} = \frac{2^{13}}{4} = 2^{11} = 2048 \text{ sets}

Step 3: Determine the address bit division

The processor uses a 32-bit address. We divide the address into Tag, Set Index, and Block Offset fields:

  • Block Offset: log⁡2(32)=5\log_2(32) = 5 bits
  • Set Index: log⁡2(2048)=11\log_2(2048) = 11 bits
  • Tag: 32−(11+5)=1632 - (11 + 5) = 16 bits

Step 4: Calculate the size of each tag directory entry

Each entry in the tag directory corresponds to one cache block and contains:

  • Address tag: 1616 bits
  • Valid bits: 22 bits
  • Modified bit: 11 bit
  • Replacement bit: 11 bit
Bits per entry=16+2+1+1=20 bits\text{Bits per entry} = 16 + 2 + 1 + 1 = 20 \text{ bits}

Step 5: Calculate the total tag directory size

Since there is one entry per cache block: Total Tag Directory Size=Total Blocks×Bits per entry\text{Total Tag Directory Size} = \text{Total Blocks} \times \text{Bits per entry} Total Tag Directory Size=8192×20 bits=163,840 bits\text{Total Tag Directory Size} = 8192 \times 20 \text{ bits} = 163,840 \text{ bits}

Converting to Kbits (1 Kbit=1024 bits1 \text{ Kbit} = 1024 \text{ bits}): Size=163,8401024=160 Kbits\text{Size} = \frac{163,840}{1024} = 160 \text{ Kbits}

Therefore, the correct option is A.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Memory Hierarchy: Cache, Main Memory and Secondary Storage questions