The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+14 votes
1.5k views

The main memory of a computer has $2$ $cm$ blocks while the cache has $2c$ 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
asked in CO & Architecture by Veteran (59.7k points)
edited by | 1.5k views

3 Answers

+23 votes
Best answer
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.$
answered by Veteran (367k points)
edited by
+2
Answer should be (k mod c)
0
That was a silly mistake. Thanks :)
0
great explanation arjun sir
+5 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
answered by Active (4.4k points)
0 votes
K(bolck no.) mod c(no of set)
answered by (149 points)
Answer:

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

44,200 questions
49,671 answers
163,564 comments
65,819 users