A direct-mapped write-back cache has 1024 lines, each with an 18-bit tag, a valid bit and a dirty bit. How many bits of metadata (excluding data) does the cache store in total?
Correct answer B. 20480
Explanation
Each line stores 18 + 1 + 1 = 20 bits of metadata, and 1024 x 20 = 20,480 bits. 18,432 counts only the tags, and 19,456 adds the valid bit but forgets the dirty bit that a write-back cache needs to know whether a line must be written to memory on eviction. A write-through cache would not need the dirty bit.
Answer checked How we write and check questions
Discussion