edited by
7,545 views
28 votes
28 votes

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

  1. $(k \mod m)$ of the cache
  2. $(k \mod c)$ of the cache
  3. $(k \mod 2c)$ of the cache
  4. $(k \mod 2\; cm)$ of the cache
edited by

3 Answers

Best answer
46 votes
46 votes
Number of cache blocks $= 2c$

Number of sets in cache $=\dfrac{2c}{2}=c$ since each set has $2$ blocks. Now, a block of main memory gets mapped to a set (associativity of $2$ just means there are space for $2$ memory blocks in a cache set), and we have $2\,cm$ blocks being mapped to $c$ sets. So, in each set $2m$ different main memory blocks can come and block $k$ of main memory will be mapped to $k \mod  c.$

Correct Answer: B.
edited by
10 votes
10 votes
Cache set no=(Main memory block no.) mod  (Total sets in cache)
total sets in cache=(total blocks in cache)/(total blocks in set)=(2c)/(2)=c
cache se no=(k) mod (c)=k mod c
1 votes
1 votes

......…...………….…......…......……........………………………………..…………………

Answer:

Related questions

35 votes
35 votes
4 answers
1
Kathleen asked Sep 23, 2014
8,961 views
The main difference(s) between a CISC and a RISC processor is/are that a RISC processor typicallyhas fewer instructionshas fewer addressing modeshas more registersis easi...
34 votes
34 votes
3 answers
3
54 votes
54 votes
3 answers
4
Kathleen asked Sep 23, 2014
15,413 views
A certain processor supports only the immediate and the direct addressing modes. Which of the following programming language features cannot be implemented on this proces...