A given system has a very small cache memory consisting of 2 cache blocks of 8 b
ID: 3829787 • Letter: A
Question
A given system has a very small cache memory consisting of 2 cache blocks of 8 bytes per block (line) for a total of 16 bytes of cache.Show, with an explanation, a sequence of memory references that has a higher hit rate with a 2-block direct-mapped cache that a fully-associative (2 block) cache. A given system has a very small cache memory consisting of 2 cache blocks of 8 bytes per block (line) for a total of 16 bytes of cache.
Show, with an explanation, a sequence of memory references that has a higher hit rate with a 2-block direct-mapped cache that a fully-associative (2 block) cache. A given system has a very small cache memory consisting of 2 cache blocks of 8 bytes per block (line) for a total of 16 bytes of cache.
Show, with an explanation, a sequence of memory references that has a higher hit rate with a 2-block direct-mapped cache that a fully-associative (2 block) cache.
Explanation / Answer
Given system has 2 cache blocks of 8 Bytes.
In 2-block direct-mapped cache,
when a new request comes, it will find appropriate place for the new block and transfer data to cache from main memory. But in case of fully-associative memory, empty place will be found and block will be transferred to that place.
Hit rate : Rate at which cache can serve requests successfully.
Most of the time fully set associative uses LRU algorithm or random block selection for block replacement.
Consider this sequence of requests for blocks : 6, 5, 7, 6
in directed mapped cache :
when request for 6 arrives, cache looks like this : 6, empty
when request for 5 arrives, cache looks like this : 6, 5
when request for 7 arrives, cache looks like this : 6, 7
when request for 6 arrives, cache already has 6 so it would not generate cache miss.
here hit ratio is 0.25% ( i.e. 3 miss out of 4 requests ).
Now, in fully associative mapping :
when request for 6 arrives, cache looks like this : 6, empty
when request for 5 arrives, cache looks like this : 6, 5
when request for 7 arrives, cache looks like this : 7, 5
when request for 6 arrives, cache looks like this : 6, 5
here in all 4 requests , there was no single cache hit. so hit ratio : 0% in given example.
now if request for 7 comes again, cache will replace 5 with 7.
hence, in fully associated cache , the hit ratio is less in given scenario.
if you have any doubts, you can ask in comment section.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.