Skip to content
Official PYQ · 2026

GATE CS 2026 Set 1 Q28 — Memory Hierarchy: Cache, Main Memory and Secondary Storage

Explain with AI

The size of the physical address space of a processor is 2322^{32} bytes. The capacity of a cache memory unit is 2232^{23} bytes. The cache block size is 128128 bytes. The cache memory unit can be built as a direct mapped cache or as a KK-way set-associative cache, where K=2LK=2^{L} and L∈{1,2,3}L \in\{1,2,3\}. Let the length of the TAG field be MM bits for the direct mapped cache, and NN bits for the set-associative cache.

Which one of the following options is true?

Choose one option
View worked solution

Answer: A

To find the relationship between the TAG field lengths MM and NN, we analyze the address division for both direct-mapped and KK-way set-associative cache configurations.

1. Given Parameters

  • Physical Address Space: 2322^{32} bytes   ⟹  \implies Physical Address (PA) length = 3232 bits.
  • Cache Capacity: 2232^{23} bytes.
  • Block Size: 128128 bytes = 272^7 bytes   ⟹  \implies Block Offset = 77 bits.
  • Total Cache Blocks: 22327=216\frac{2^{23}}{2^7} = 2^{16} blocks.

2. Direct-Mapped Cache

In a direct-mapped cache, each block in the cache corresponds to a unique index.

  • Number of Index Bits: log⁡2(Total Blocks)=log⁡2(216)=16\log_2(\text{Total Blocks}) = \log_2(2^{16}) = 16 bits.
  • TAG Bits (MM): M=PA length−Index bits−Block Offset bitsM = \text{PA length} - \text{Index bits} - \text{Block Offset bits} M=32−16−7=9 bitsM = 32 - 16 - 7 = 9 \text{ bits}

3. KK-Way Set-Associative Cache

Here, the cache is divided into sets, where each set contains K=2LK = 2^L blocks.

  • Number of Sets: Total BlocksK=2162L=216−L\frac{\text{Total Blocks}}{K} = \frac{2^{16}}{2^L} = 2^{16-L} sets.
  • Number of Set Index Bits: log⁡2(216−L)=16−L\log_2(2^{16-L}) = 16 - L bits.
  • TAG Bits (NN): N=PA length−Set Index bits−Block Offset bitsN = \text{PA length} - \text{Set Index bits} - \text{Block Offset bits} N=32−(16−L)−7=9+L bitsN = 32 - (16 - L) - 7 = 9 + L \text{ bits}

4. Relationship Between MM and NN

Substituting M=9M = 9 into the expression for NN:

N=M+LN = M + L

Thus, 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