Skip to content
Official PYQ · 2026

GATE CS 2026 Set 2 Q42 — Memory Hierarchy: Cache, Main Memory and Secondary Storage

Explain with AI

Consider a system with a processor and a 44 KB direct mapped cache with block size of 1616 bytes. The system has a 1616 MB physical memory. Four words P,Q,R\mathrm{P}, \mathrm{Q}, \mathrm{R}, and S are accessed by the processor in the same order 1010 times. That is, there are a total of 4040 memory references in the sequence P,Q,R,S,P,Q,R,S,…\mathrm{P}, \mathrm{Q}, \mathrm{R}, \mathrm{S}, \mathrm{P}, \mathrm{Q}, \mathrm{R}, \mathrm{S}, \ldots


Assume that the cache memory is initially empty. The physical addresses of the words are given below (11 word =1=1 byte).

P: 0x845B32, Q: 0x845B26, R: 0x845B36, S: 0x846B32\text{P: 0x845B32, Q: 0x845B26, R: 0x845B36, S: 0x846B32}

Which of the following statements is/are true?
Note: 1 K=2101 \mathrm{~K}=2^{10} and 1M=2201 \mathrm{M}=2^{20}

Select all correct options
View worked solution

Answer: A;B

To determine the cache hit/miss behavior, we first analyze how the 24-bit physical address is split into Tag, Index, and Offset fields:

  • Physical Address Space: 16 MB=224 bytes  ⟹  24 bits16\text{ MB} = 2^{24}\text{ bytes} \implies 24\text{ bits}
  • Block Size: 16 bytes=24 bytes  ⟹  4 bits16\text{ bytes} = 2^4\text{ bytes} \implies 4\text{ bits} Offset (last hex digit)
  • Number of Cache Blocks: 4 KB16 bytes=256=28  ⟹  8 bits\frac{4\text{ KB}}{16\text{ bytes}} = 256 = 2^8 \implies 8\text{ bits} Index (middle 2 hex digits)
  • Tag Size: 24−8−4=12 bits24 - 8 - 4 = 12\text{ bits} Tag (first 3 hex digits)

Using this mapping, we extract the fields for each address:

WordAddressTag (12 bits)Index (8 bits)Offset (4 bits)
P0x845B320x8450xB30x2
Q0x845B260x8450xB20x6
R0x845B360x8450xB30x6
S0x846B320x8460xB30x2

Note that P and R reside in the exact same cache block (same Tag 0x845 and Index 0xB3), while S maps to the same index 0xB3 but with a different Tag 0x846. Q maps to a different index 0xB2.

Let us trace the access sequence P, Q, R, S, P, Q, R, S, …\text{P, Q, R, S, P, Q, R, S, } \dots

  • Iteration 1:
    • P (Index 0xB3): Miss (cold). Block 0x845B3 is loaded.
    • Q (Index 0xB2): Miss (cold). Block 0x845B2 is loaded.
    • R (Index 0xB3): Hit (since block 0x845B3 is already in index 0xB3).
    • S (Index 0xB3): Miss (conflict). Block 0x846B3 replaces block 0x845B3.
  • Iteration 2 to 10:
    • P (Index 0xB3): Miss (conflict with S). Block 0x845B3 is loaded.
    • Q (Index 0xB2): Hit (block 0x845B2 remains undisturbed).
    • R (Index 0xB3): Hit (block 0x845B3 was just loaded by P).
    • S (Index 0xB3): Miss (conflict with P/R). Block 0x846B3 is loaded.

Thus:

  • A is True: Every access to P\text{P} results in a cache miss.
  • B is True: Every access to R\text{R} results in a cache hit.
  • C is False: Only the first access to Q\text{Q} is a miss; the remaining 9 are hits.
  • D is False: Every access to S\text{S} results in a cache miss.

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