Skip to content
Official PYQ · 2013

GATE CS 2013 Q53 — Memory Management and Virtual Memory

Explain with AI

A computer uses 46-bit46\text{-bit} virtual address, 32-bit32\text{-bit} physical address, and a three–level paged page table organization. The page table base register stores the base address of the first-level table (T1),\text{(T1)}, which occupies exactly one page. Each entry of T1\text{T1} stores the base address of a page of the second-level table (T2).\text{(T2)}. Each entry of T2\text{T2} stores the base address of a page of the third-level table (T3).\text{(T3)}. Each entry of T3\text{T3} stores a page table entry (PTE).\text{(PTE)}. The PTE\text{PTE} is 32  bits32\;\text{bits} in size. The processor used in the computer has a 1  MB  161\;\textsf{MB}\; 16 way set associative virtually indexed physically tagged cache. The cache block size is 6464 bytes.


What is the minimum number of page colours needed to guarantee that no two synonyms map to different sets in the processor cache of this computer?

Choose one option
View worked solution

Answer: C

To find the minimum number of page colors, we first need to determine the page size and then analyze the cache indexing structure.

Step 1: Determine the Page Size

Let the page size be 2p2^p bytes, so the page offset is pp bits. Since the physical address is 3232 bits, a page table entry (PTE) of 3232 bits (44 bytes) is sufficient to store a physical page frame address.

  • The number of entries per page of a page table is 2p22=2p−2\frac{2^p}{2^2} = 2^{p-2}.
  • Thus, each level of the page table index (d1,d2,d3d_1, d_2, d_3) requires p−2p-2 bits.

The virtual address is split as follows:

d1+d2+d3+page_offset=46 bitsd_1 + d_2 + d_3 + \text{page\_offset} = 46 \text{ bits} (p−2)+(p−2)+(p−2)+p=46  ⟹  4p−6=46  ⟹  p=13(p-2) + (p-2) + (p-2) + p = 46 \implies 4p - 6 = 46 \implies p = 13

So, the page offset is 1313 bits, and the page size is 213=8 KB2^{13} = 8\text{ KB}.

Step 2: Determine Cache Parameters

  • Cache Size = 1 MB=2201\text{ MB} = 2^{20} bytes
  • Block Size = 64 bytes=2664\text{ bytes} = 2^6 bytes
  • Associativity = 16=2416 = 2^4
  • Number of Sets = Cache SizeBlock Size×Associativity=22026×24=210\frac{\text{Cache Size}}{\text{Block Size} \times \text{Associativity}} = \frac{2^{20}}{2^6 \times 2^4} = 2^{10} sets

To index the cache, we need:

  • Block offset = 66 bits
  • Set index = 1010 bits
  • Total bits for cache indexing = 6+10=166 + 10 = 16 bits

Step 3: Calculate Page Colors

In a virtually indexed, physically tagged (VIPT) cache, synonyms (different virtual addresses mapping to the same physical address) can map to different cache sets if the virtual address bits used for cache indexing overlap with the virtual page number (VPN) bits.

  • Bits used for cache indexing = 1616 bits
  • Bits in page offset = 1313 bits
  • Overlapping bits = 16−13=316 - 13 = 3 bits

The minimum number of page colors required to prevent synonym conflicts is:

2overlapping bits=23=82^{\text{overlapping bits}} = 2^3 = 8

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Memory Management and Virtual Memory questions