Some things you should know about … cache

 

(For the following, always assume 32-bit addresses)

 

1. a. 16K, 8-way set assoc, 16 sets.

     Block size? ________

     Bits in each field?      index________

                        offset_______

                        tag__________

 

   b. What happens to block size if we hold

       everything else constant but ....

       i. Increase size by a factor of two? ___________

       ii. Decrease set assoc by factor of two? _______

       iii. Double the number of sets? ________________

 

 

   c. Give the general symbolic equation for the relation

      of the above factors.

 

 

2. Given these situations, say whether the idea is a good

   one (i.e. will make the cache faster)... Assume

   reasonable starting values for each of the factors.

   e.g. 16K, 2-way, 4-wd blocks works well for an 'average'

   program.

 

   1a. Program that does lots of linear accesses with small

      strides..

      a. bigger blocks for fewer sets?____________________

       Why?

      b. bigger blocks for lower set assoc?_______________

       Why?

      c. more assoc, fewer sets?__________________________

       Why?

 

   1b. Program that does lots of linear accesses with huge

      strides..

      a. bigger blocks for fewer sets?____________________

       Why?

      b. bigger blocks for lower set assoc?_______________

       Why?

      c. more assoc, fewer sets?__________________________

       Why?

 

   2a. Program that makes completely random accesses.

      a. bigger blocks for fewer sets?____________________

       Why?

      b. bigger blocks for lower set assoc?_______________

       Why?

      c. more assoc, fewer sets?__________________________

       Why?

 

   2b. Program that accesses a few elements over and over.

      a. bigger blocks for fewer sets?____________________

       Why?

      b. bigger blocks for lower set assoc?_______________

       Why?

      c. more assoc, fewer sets?__________________________

       Why?

 

 

3. True or false:

 

   1. If cost is not a factor, a bigger cache is always a

      better cache?

 

   2. If cost is not a factor, more blocks is always a

      better cache?

 

   3. If cost is not a factor, bigger blocks is always a

      better cache?

 

   4. If cost is not a factor, higher set-assoc is always a

      better cache?