Skip to content

GATE CS 2020 Q30 — Memory Hierarchy: Cache, Main Memory and Secondary Storage

Explain with AI

A computer system with a word length of 3232 bits has a 1616 MB byte- addressable main memory and a 6464 KB, 44-way set associative cache memory with a block size of 256256 bytes. Consider the following four physical addresses represented in hexadecimal notation.

  • A1=0x42C8A4A1= \textsf{0x42C8A4},
  • A2=0x546888A2= \textsf{0x546888},
  • A3=0x6A289CA3= \textsf{0x6A289C},
  • A4=0x5E4880A4=\textsf{0x5E4880}

Which one of the following is TRUE?

Choose one option
View worked solution

Answer: B

To determine which cache set each physical address maps to, we first analyze the division of the physical address bits.

1. Address Bit Division:

  • Main Memory Size: 16 MB=22416\text{ MB} = 2^{24} bytes   ⟹  \implies Physical Address = 2424 bits.
  • Block Size: 256 bytes=28256\text{ bytes} = 2^8 bytes   ⟹  \implies Block Offset = 88 bits.
  • Number of Cache Blocks: 64 KB256 B=21628=256\frac{64\text{ KB}}{256\text{ B}} = \frac{2^{16}}{2^8} = 256 blocks.
  • Number of Sets: Since the cache is 44-way set associative, Number of Sets=2564=64=26\text{Number of Sets} = \frac{256}{4} = 64 = 2^6 sets   ⟹  \implies Set Index = 66 bits.
  • Tag: 24−(6+8)=1024 - (6 + 8) = 10 bits.

Thus, the 2424-bit physical address is structured as:

[ Tag (10 bits) | Set Index (6 bits) | Block Offset (8 bits) ]

2. Extracting Set Index for each Address:

Since the block offset is the lower 88 bits (corresponding to the last 22 hexadecimal digits), the Set Index consists of the next 66 bits.

  • A1=0x42C8A4A1 = \text{0x42C8A4}
    Binary: 0100 0010 11⏟Tag 00 1000⏟Set Index 1010 0100⏟Offset\underbrace{0100\,0010\,11}_{\text{Tag}}\ \underbrace{00\,1000}_{\text{Set Index}}\ \underbrace{1010\,0100}_{\text{Offset}}
    Set Index = 0010002=810001000_2 = 8_{10}
  • A2=0x546888A2 = \text{0x546888}
    Binary: 0101 0100 01⏟Tag 10 1000⏟Set Index 1000 1000⏟Offset\underbrace{0101\,0100\,01}_{\text{Tag}}\ \underbrace{10\,1000}_{\text{Set Index}}\ \underbrace{1000\,1000}_{\text{Offset}}
    Set Index = 1010002=4010101000_2 = 40_{10}
  • A3=0x6A289CA3 = \text{0x6A289C}
    Binary: 0110 1010 00⏟Tag 10 1000⏟Set Index 1001 1100⏟Offset\underbrace{0110\,1010\,00}_{\text{Tag}}\ \underbrace{10\,1000}_{\text{Set Index}}\ \underbrace{1001\,1100}_{\text{Offset}}
    Set Index = 1010002=4010101000_2 = 40_{10}
  • A4=0x5E4880A4 = \text{0x5E4880}
    Binary: 0101 1110 01⏟Tag 00 1000⏟Set Index 1000 0000⏟Offset\underbrace{0101\,1110\,01}_{\text{Tag}}\ \underbrace{00\,1000}_{\text{Set Index}}\ \underbrace{1000\,0000}_{\text{Offset}}
    Set Index = 0010002=810001000_2 = 8_{10}

Comparing the set indices, we find that A2A2 and A3A3 both map to set 4040.

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