the answers to Problem 5
A student writes:
Dear Dr. Patt,
I had a doubt in the problem set question number 5. It asks to
calculate the hit rate for a direct mapped , fully associative
and a four way associative cache.
Block size=4bytes, no. of blocks=8
no. of lru bits for direct mapped caches=0
no. of lru bits for fully associated caches=3bits/block
no. of lru bits for 4 way associated caches=2bits/block
1. for a direct mapped cache,my hit rate= ********
2. for a fully associated cache, hit rate= *********
3. for a four way associated cache, hit rate= ********
These results seem to be orthogonal to what associativity
does to caches. In my understanding, associativity increases the
hit ratio, but the answers suggest otherwise. Please suggest if
I am doing something wrong.
sincerely
<<name withheld to protect the good engineering student
who questions results when they are counterintuitive>>
I deleted the answers the student came up with because they were exactly
correct, and I did not want to spoil the fun of solving the problem for
the rest of you.
I apologize for not including a second sequence of accesses for which the
answers would be as expected, AND also for not pointing out in the statement
of this problem that even though we expect certain behavior with respect to
hit ratio as we increase set-associativity, sometimes we run into a
pathological case where the property acts contrary to what we expect.
Sorry to have caused some of you some anxious moments.
Yale Patt