Cache Memory


Answer & solution
Official answer: C
There are 220/(16×64)=210 cache sets. A 64-byte cache block uses six offset bits, so the ten set-index bits are virtual-address bits 6 through 15. From the preceding linked question, the page size is 8 KiB and the page offset consists of bits 0 through 12. Only seven set-index bits (6 through 12) lie inside the page offset and are automatically identical for synonyms. The remaining three bits (13 through 15) can differ between virtual aliases of the same physical page. Distinguishing 23=8 page colours, and requiring aliases of a physical page to use the same colour, makes all index bits agree. Thus eight colours are necessary and sufficient, option C. Equivalently, colours=(cache size)/(associativity×page size)=1 MiB/(16×8 KiB)=8.
Synonyms share a physical page but can have different virtual page numbers. A VIPT lookup uses virtual index bits before the physical tag is known; if any such bit is outside the page offset, aliases can select different sets. Here10 index bits follow 6block-offset bits, ending at bit15. Only bits 0–12belong to the 8KiBpage offset, leaving three potentially different index bits. Colouring controls exactly those three bits, requiring eight choices. More tag bits do not repair selection of the wrong set.