Exams › GATE › Technical
In a k-way set associative cache, the cache is divided into v sets, each of which consists of k lines. The lines of a set are placed in sequence one after another. The lines in sets are sequenced before the lines in set (s+1). The main memory blocks are numbered 0 onwards. A main memory block numbered j must be mapped to any one of the cache lines from
- (j mod v) * k to (j mod v) * k + (k-1)
- (j mod v) to (j mod v) + (k-1)
- (j mod k) to (j mod k) + (v-1)
- (j mod k) * v to (j mod k) * v + (v-1)
Correct answer: (j mod v) * k to (j mod v) * k + (k-1)
Solution
The correct option accurately describes how a main memory block is mapped to a specific range of cache lines in a k-way set associative cache. It indicates that the block indexed by j can occupy any of the k lines within the set determined by the modulo operation with v, ensuring that the mapping adheres to the structure of the cache.
Related GATE Technical questions
⚔️ Practice GATE Technical free + battle 1v1 →