Consider a memory system with 1M bytes of main memory and 16K bytes of cache…

2025

Consider a memory system with 1M bytes of main memory and 16K bytes of cache memory. Assume that the processor generates 20-bit memory address, and the cache block size is 16 bytes. If the cache uses direct mapping, how many bits will be required to store all the tag values? [Assume memory is byte addressable, 1K=210 , 1M=220 ]

  1. A.

    6 × 210

  2. B.

    8 × 210

  3. C.

    212

  4. D.

    214

Attempted by 313 students.

Show answer & explanation

Correct answer: A

Answer: 6 × 2^10 = 6144 bits

Reasoning:

  • Block offset: block size = 16 bytes → offset bits = log2(16) = 4 bits.

  • Number of cache lines: cache size = 16K = 2^14 bytes; lines = 2^14 / 2^4 = 2^10 = 1024 lines → index bits = 10.

  • Tag bits per line: address bits (20) - index bits (10) - offset bits (4) = 6 bits.

  • Total bits to store all tags: 6 bits per line × 1024 lines = 6 × 2^10 = 6144 bits.

Thus the choice '6 × 2^10' is the correct representation of the total tag storage.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir