174k views
4 votes
Assume the system with 256B memory and 64B cache and the block size of 16 bytes. I.e., there are 4 blocks in the cache.

2. Assume the system as question 1. Assume cache is initially empty, i.e., all 4 cache blocks are invalid. Consider the memory reference sequence: D6, 58, D8, 9A, DE, 5C.

(a) Indicate if it is a hit or misss for each memory reference if it is direct-mapped cache. What is the miss ratio?(Hint: Three memory block 50-5F, 90-9F, and D0-DF would be copied to the same block in the cache because their block index is the same, 1.)

(b) Indicate if it is a hit or misss for each memory reference if it is fully-associative cache? What is the miss ratio?

(c) Indicate if it is a hit or misss for each memory reference if it is 2-way set-associative cache? What is the miss ratio? Assume to replace the block which has been used "least recently".(Hint: Three memory block 50-5F, 90-9F, and D0-DF would be copied to the same "set" in the cache because their "set" index is the same, 1. In each set, there are 2 blocks.)

User Naryl
by
5.7k points

1 Answer

5 votes

Answer:

a. 100%

b. 50%

c. 66.6%

Step-by-step explanation:

a.

The memory references D6, 58, D8, 9A, DE and 5C all results in misses and the miss ratio is 100 (that is , 6 misses/ 6 references*100 = 100%)

b.

If fully associative cache is used, there will be a 3 cache misses with miss ratio of (3/6*100) = 50%.

c.

With a 2-way set-associative cache, 4 memory reference misses will occur, with a miss ratio of (4/6*100)= 66.6% misses.

User Nrlakin
by
4.3k points