GATE / CS ARCHIVE

SIMILAR QUESTIONS / COMPUTER ORGANIZATION & ARCHITECTURE

Count total cache tag and metadata storage

5 questions solved the same way, newest first. Back to Computer Organization & Architecture

How these are solved

First derive the tag width and number of cache lines, then multiply per-line tag plus explicitly required metadata by the line count and convert bits/bytes as requested. The 2001, 2008 and 2025 variants ask tag-only storage;

2 marks · MCQ
Report issue

Calculating direct-mapped cache tag storage

Cache Memory

Question 36, GATE 2025: A byte-addressable system has 1 MiB of main memory, 20-bit addresses, and a 16 KiB direct-mapped cache with 16-byte blocks. How many bits store the tag values for all lines, excluding other metadata? A 6×2^10; B 8×2^10; C 2^12; D 2^14. Here K=2^10 and M=2^20.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Step through it (7 steps)

Approach: Split an address into tag, cache-line index and byte offset; then multiply tag width by the number of lines.
A 16-byte block requires log₂16=4 offset bits. The cache contains 16 KiB/16 bytes=214/24=210 lines, so direct mapping requires 10 index bits to select a line.
From the 20 address bits, the remaining tag width is 20−10−4=6 bits. Every line needs its own stored tag to distinguish the main-memory blocks that map to that line. Therefore total tag storage is 210×6=6144 bits, option A.
This is a bit count, not a byte count. The 16 KiB cache size describes data capacity; valid bits, dirty bits and other control metadata are not part of the requested tag values. Ignoring the block offset or using the number of bytes instead of lines would produce the wrong tag width or multiplier.

Original paper, page 36 · Answer key

2 marks · MCQ
Report issue

Cache directory size including per-line metadata

Cache Memory

Question 55, GATE 2012: A 256 KByte, four-way set-associative write-back cache uses 32-byte blocks and 32-bit byte addresses. Every tag-directory entry holds the tag plus 2 valid bits, 1 modified bit, and 1 replacement bit.
What is the tag-directory size?
(A) 160 Kbits (B) 136 Kbits (C) 40 Kbits (D) 32 Kbits.
Question 55, GATE 2012: A 256 KByte, four-way set-associative write-back cache uses 32-byte blocks and 32-bit byte addresses. Every tag-directory entry holds the tag plus 2 valid bits, 1 modified bit, and 1 replacement bit.
What is the tag-directory size?
(A) 160 Kbits (B) 136 Kbits (C) 40 Kbits (D) 32 Kbits.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Step through it (9 steps)

There are 256×1024/32=8192 cache lines and hence 8192 tag-directory entries. The preceding calculation gives a 16-bit address tag. Each entry additionally has the explicitly specified 2 valid bits, 1 modified bit and 1 replacement bit, for 16+2+1+1=20 bits. The directory is 8192×20=163, 840 bits=160 Kibits, option A (printed as Kbits). Count entries per cache line, not per set; the problem explicitly assigns the replacement bit per entry.

Check: Four ways do not mean only one tag per set: each way stores a distinct block and needs its own tag and metadata. Equivalently, 2048 sets×4 entries/set×20 bits/entry=163840 bits, confirming the per-line calculation.

Original paper, page 15 · Answer key

2 marks · MCQ
Report issue

Write-back direct-mapped cache metadata

Cache Memory

Question 43, GATE 2011: An 8 KB direct-mapped write-back cache has 32-byte blocks and 32-bit byte addresses. Metadata per cache block contains one valid bit, one modified bit, and the minimum tag bits needed to identify the mapped memory block. How many metadata bits are needed in total?

(A) 4864
(B) 6144
(C) 6656
(D) 5376
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Step through it (8 steps)

There are 8192/32=256 cache lines, requiring 8 index bits. A 32-byte block requires 5 byte-offset bits, leaving 32−8−5=19 address-tag bits. Add one valid bit and one modified (dirty) bit per line: 21 bits per line. The metadata memory is therefore 256×21=5376 bits, option D. Data storage itself is not included.

Interpret 8 KB as 8×1024 bytes in the conventional cache model. The address splits into [19 tag bits][8 line-index bits][5 block-offset bits]. The index chooses one of the 256 lines, and the offset selects a byte within its 32-byte block. Only the tag must be stored as an address identifier; index and offset are implicit in placement. Write-back additionally needs the dirty bit to decide whether eviction must write data to memory, while valid distinguishes populated from unused entries.

Original paper, page 11 · Answer key

2 marks · MCQ
Report issue

Total virtual cache-tag storage

Cache Memory

Question 71, GATE 2008: A machine has a 64-KiB, two-way set-associative data cache with 16-byte blocks, managed using 32-bit virtual addresses; pages are 4 KiB. A row-major double ARR[1024][1024] starts at the beginning of virtual page 0xFF000. A double occupies 8 bytes. The cache is initially empty, there is no prefetching, and only ARR causes data-memory references. The code is:
for(i=0;i<1024;i++)
 for(j=0;j<1024;j++) ARR[i][j]=0.0;
What is the total tag storage in the cache directory?

(A) 32 Kibits
(B) 34 Kibits
(C) 64 Kibits
(D) 68 Kibits
Question 71, GATE 2008: A machine has a 64-KiB, two-way set-associative data cache with 16-byte blocks, managed using 32-bit virtual addresses; pages are 4 KiB. A row-major double ARR[1024][1024] starts at the beginning of virtual page 0xFF000. A double occupies 8 bytes. The cache is initially empty, there is no prefetching, and only ARR causes data-memory references. The code is:
for(i=0;i<1024;i++)
 for(j=0;j<1024;j++) ARR[i][j]=0.0;
What is the total tag storage in the cache directory?

(A) 32 Kibits
(B) 34 Kibits
(C) 64 Kibits
(D) 68 Kibits
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. The 64-KiB cache with 16-byte blocks contains 4096 lines. Two ways give 2048 sets, requiring 11 index bits; the byte offset needs 4 bits.
2. The 32-bit virtual address therefore leaves 32−11−4=17 tag bits per line. Total tag storage is 4096×17=69632 bits=68 Kibits, option D.
3. Valid, dirty and replacement bits are not tags and are excluded.

Original paper, page 15

Descriptive
Report issue

Cache tag storage overhead

Cache Memory

Question 9(e), GATE 2001: 32-bit byte addresses; cache data capacity 256 KB=2^18 bytes; 4-way set associative; 16-byte blocks.

Task: Find total extra memory in bytes required for tag bits.
Question 9(e), GATE 2001: 32-bit byte addresses; cache data capacity 256 KB=2^18 bytes; 4-way set associative; 16-byte blocks.

Task: Find total extra memory in bytes required for tag bits.
Tap to enlarge
Shared context

32-bit byte addresses; cache data capacity 256 KB=2^18 bytes; 4-way set associative; 16-byte blocks.

Answer & solution

Answer: 32,768 bytes = 32 KiB for tags only. (no official key was published)

Step through it (8 steps)

1. Total cache blocks equal 256×1024/16=16,384. Every resident block requires its own tag even though blocks share a set index.

2. Each tag has 32−12−4=16 bits. Thus tag storage is 16,384×16=262,144 bits.

3. Convert bits to bytes by dividing by 8: 262,144/8=32,768 bytes, or 32 KiB.

4. This is only the requested tag-bit memory. Valid bits, dirty bits, and replacement metadata would add storage, but their costs are not part of the tag-only question and are not silently included.

Original paper, page 8