In a -way set associative cache, the cache is divided into sets, each of which consists of lines. The lines of a set are placed in sequence one after another. The lines in set are sequenced before the lines in set . The main memory blocks are numbered 0 onwards. The main memory block numbered must be mapped to any one of the cache lines from
View worked solution
Answer: A
In a -way set associative cache, the cache is divided into sets, where each set contains exactly cache lines.
A main memory block is mapped to set using the modulo operation:
Since the cache lines are laid out sequentially, and each set contains lines:
- Set occupies lines to .
- Set occupies lines to .
- In general, set occupies lines from to .
Substituting into the range, block can be mapped to any line in the range:
This matches Option A.
Free practice · Your answers on this page are not saved.
