edited by
7,823 views
16 votes
16 votes

Consider a Direct Mapped Cache with 8 cache blocks (numbered $0-7$). If the memory block requests are in the following order

$3, 5, 2, 8, 0, 63, 9,16, 20, 17, 25, 18, 30, 24, 2, 63, 5, 82,17, 24.$

Which of the following memory blocks will not be in the cache at the end of the sequence ?

  1. $3$
  2. $18$
  3. $20$
  4. $30$
edited by

3 Answers

Best answer
25 votes
25 votes

Answer is (B).

Cache location (memory block) = block req mod number of cache blocks. Since each block has only one location (associativity is $1$) the last mod $8$ request will be in cache (no need of any replacement policy as mapping is direct).

$3, 5, 2, 8, 0, 63, 9, 16, 20, 17, 25, 18, 30, 24, 2, 63, 5, 82, 17, 24$

Block $0- 8$, $ 0, 16, 24, 24$. At end contains $24.$
1- $9, 17, 25, 17.  $
2- $2, 18, 2, 82.$
3- $3$.
4- $20.$
5- $5, 5.$
6- $30.$
7- $63 63.$

So, memory block $18$ is not in cache while $3$, $20$ and $30$ are in cache.

edited by
7 votes
7 votes

in direct mapping function is used to map the data.

(main memory block number) MOD (number of cache memory line)=cache memory line number.

0 votes
0 votes

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

Answer:

Related questions

56 votes
56 votes
5 answers
1