In a k-way set associative cache, the cache is divided into v sets, each of…
2021
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 set s are sequenced before the lines in set (s+1).The main memory blocks are numbered from 0 onwards. The main memory block numbered j must be mapped to any one of the cache lines from:
- A.
( j mod v)* k to ( j mod v) * k+(k–1)
- B.
( j mod v) to ( j mod v) + (k–1)
- C.
( j mod k) to ( j mod k) + (v–1)
- D.
( j mod k) * v to ( j mod k) * v + (v–1)
- E.
Question not attempted
Attempted by 90 students.
Show answer & explanation
Correct answer: A
In a k-way set associative cache, memory block j maps to the set index calculated as j modulo v. Since each set contains k lines sequentially, the specific cache lines for this block range from (j mod v) multiplied by k up to that value plus k minus one.