in CO and Architecture retagged by
715 views
6 votes
6 votes

Assume a cache memory with the following properties:

  • The cache size $\text{(C)}$ is 512 bytes (contains $512$ data bytes)
  • The cache uses an LRU (least recently used) policy for eviction.
  • The cache is initially empty.

Suppose that for the following sequence of addresses sent to the cache, $\mathrm{0 , 2 , 4 , 8 , 1 6 , 3 2}$, the hit rate is $\mathrm{0. 3 3}$. Then what is the block size $\text{(B)}$ of the cache?

  1. $\text{B}=4$ bytes
  2. $\text{B}=8$ bytes
  3. $\text{B}=16$ bytes
  4. None of the above.
in CO and Architecture retagged by
715 views

1 Answer

6 votes
6 votes

For (A) the sequence of accesses will result in $\textsf{M H M M M M},$ hit rate $= 0.16$
For (B) the sequence of accesses will result in $\textsf{M H H M M M,}$ hit rate $= 0.33$
For (C) the sequence of accesses will result in $\textsf{M H H H M M},$ hit rate $= 0.5$

Hence, the answer is (B).

Helpful Comment: https://gateoverflow.in/421140/go-classes-test-series-2024-mock-gate-test-13-question-54?show=421376#c421376 

edited by

4 Comments

Please explain in a good way at least.
3
3
I guess it should’ve been mentioned in the question Memory is byte addressable. For block size 4B, address 0 will be a miss, hence addresses 0-3 will be brought into cache. So only 2 would be a hit and rest of the addresses will be misses. For block size 8B, 0 will again be a miss and addresses 0-7 will be brought into cache, hence addresses 2,4 will be hits. 16 will be a miss and addresses 16-23 will be brought into cache and 32 will again be a miss. Hence 2 hits out of 6 => 0.33 hitrate.
20
20
Really thankyou
0
0

@TotalBiscuit, Nicely explained. Note that memory is by default always byte addressable if nothing is given. 

3
3
Answer:

Related questions