Warning: count(): Parameter must be an array or an object that implements Countable in /home/customer/www/thegatebook.in/public_html/qa/qa-include/qa-theme-base.php on line 177

# CO-Grand Test -Q6

Warning: count(): Parameter must be an array or an object that implements Countable in /home/customer/www/thegatebook.in/public_html/qa/qa-include/qa-theme-base.php on line 177
+1 vote

A processor with a word-addressable memory has a two-way set-associative cache. A cache line is one word, so a cache entry contains a set of two words. If there are M words of memory and C cache entries, how many words of memory map to the same cache entry?

(A)$.$ M / C

(B)$.$ 2M / C

(C)$.$ M / 2C

(D)$.$ M / 2

edited Oct 7, 2020

Block size = One word.

So M words of memory means M blocks.

A two-way set-associative cache. A cache line is one word, so a cache entry contains a set of two words.

Cache entry has been defined to be a set, not line.

There are C cache entries in the cache, so, there are C Sets in the cache.

There are M blocks in main memory.

In set-associative cache, if there are n sets then a block number B of main memory will go to the set number $B \ mod \ n$.

So, to each set, there will be

$\frac{M}{C}$     blocks which will map to each set(cache entry).

Note that the number of words of memory map to the same cache line :

Inside a set, the block can go to any line,  So,     $\frac{M}{C}$    blocks map to a particular line in the cache.

answered Jun 20, 2020 by (226,240 points)