retagged by
1,000 views

2 Answers

Best answer
2 votes
2 votes
Let m be the memory block

Calculate no of sets(p)=x/k

Block m will be mapped to any one of block of set no m%p

In this way consecutive memory blocks will be going to different sets in cache there by making use of spatial locality.
0 votes
0 votes

number of lines in cache = x

number of memory locations= number of memory blocks= 2^n

since it is k-set associative, number of sets given by x/k

now mapping will be done from main memory to cache --->

(2^n) / (x/k) will tell how many memory blocks can reside in one set of cache

however, if m is any particular memory block:-

then its set location in cache given by

m mod (x/k)

edited by

Related questions

3 votes
3 votes
2 answers
1
biranchi asked Nov 16, 2016
4,794 views
Consider the memory system in which the block size in cache and main memory are equal. Cache consists of 512 blocks and main memory consists of 8192 blocks. Cache is 4-wa...