2
$\begingroup$

I am trying to understand the following claim:

For a fixed size cache, each increase by a factor of two in associativity doubles the number of blocks per set (i.e., the number or ways) and halves the number of sets – decreases the size of the index by 1 bit and increases the size of the tag by 1 bit.

enter image description here I am just wondering if someone can clear this up for me. For example, if there is a cache with 16 cachelines and it's 2-associative the number of blocks per set is 8, but if we increase by a factor of two associativity then the number of blocks per set decreases to 4.

$\endgroup$
1
  • 1
    $\begingroup$ The title you have chosen is not well suited to representing your question. Please take some time to improve it; we have collected some advice here. Thank you! $\endgroup$
    – Raphael
    Commented Dec 4, 2016 at 2:20

2 Answers 2

1
$\begingroup$

Actually he was referring about the blocks that can be placed in the cache from the Main memory. from your example 16 cache lines - 2 way set associative | assuming 32 blocks in Main Memory

so there are 8 blocks per set so each set will have 32/8 = 4 blocks now, made into a 4 way set associative | same 32 blocks of main memory

so there are 4 blocks per set so each set will have 32/4 = 8 blocks they are doubled so you need 1 more bit to represent it by having same tag but appending it with 1 or 0 at the front

Similarly the sets are getting halved, i think you got that part

$\endgroup$
1
$\begingroup$

The number of sets determines the size of the index, because the index tells you what set to refer to. If you increase associativity by giving more blocks to each set then you run out of blocks sooner and so you can afford fewer sets. If you have fewer sets then you have a smaller index.

If half the sets disappear then those addresses have to be handled by the remaining sets. Because each set now has more addresses that it serves, it needs an extra bit of tag to distinguish them.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.