Question
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
Official answer and solution
- Official answer
- A
- From
- Official GATE 2013 answer key
Solution
Derive the set index for memory block j and multiply by line capacity k to obtain the line number range.
In a -way set associative cache:
- Total number of sets .
- Each set contains lines.
- A main memory block numbered maps to set index:
Because the cache lines are arranged sequentially set by set:
- Set 0 occupies lines through .
- Set 1 occupies lines through .
- In general, set begins at line and ends at line .
Substituting :
Thus, block may be placed in any cache line from to .
Option (A)
Confusing the number of sets with associativity in the modulo operation.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2013 Computer Science and Information Technology (CS)
- Question
- 20 of 65, printed as CS Q.20
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.