Skip to content

GATE CS 1999 Q1.22 — Memory Hierarchy: Cache, Main Memory and Secondary Storage

Explain with AI

The main memory of a computer has 2  cm2\;\text{cm} blocks while the cache has 2  c2\;\text{c} blocks. If the cache uses the set associative mapping scheme with 22 blocks per set, then block kk of the main memory maps to the set:

Choose one option
View worked solution

Answer: B

In a set-associative cache mapping scheme, a main memory block kk maps to a cache set index calculated as:

Set Index=k(modS)\text{Set Index} = k \pmod S

where SS is the total number of sets in the cache.

From the given problem details:

  • The total number of blocks in the cache is 2c2c.
  • The cache is 22-way set-associative (i.e., there are 22 blocks per set).

We can calculate the total number of sets SS in the cache as:

S=Total cache blocksBlocks per set=2c2=cS = \frac{\text{Total cache blocks}}{\text{Blocks per set}} = \frac{2c}{2} = c

Substituting S=cS = c into the mapping formula, main memory block kk maps to the set:

Set Index=k(modc)\text{Set Index} = k \pmod c

Hence, the correct option is B.

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