Reputation:
Have a doubt about Compulsory/Cold misses for a Cache Memory. My knowledge about a compulsory miss is that It is the very first access to a block , independent of the cache size.
Cold Misses are affected by increasing/decreasing the block size. Here is my understanding, which seems to fit.
By increasing the block size, the number of blocks in the cache should
reduce, assuming the size of the cache is constant here. Therefore there
would be decreased number of first time requests for each block. Hence the
cold miss should decrease.
Correspondingly if the block size is decreased, the number of blocks would
increase, and hence the number of requets to access blocks for the first
time would also increase.
But I am not able to understand how it is Not Affected by Increasing or Decreasing the Cache Size OR Increasing/Decreasing the associativity of the cache !!
If the Cache Size increases, then the number of blocks also increase. So
the cold misses should increases, as more number of empty blocks would
be requested for the first time ???
Similarly if the Cache Size is Decreased, the number of blocks would
decrease which would have to be probed for the first time ??
My same doubt applies to increasing/decreasing the associativity as well.
Looking for a better understanding of this. Help is greatly appreciated.
Thanks, Ankit
Upvotes: 1
Views: 2313
Reputation: 363970
Yes, increasing the size of each block decreases the total number of blocks touched by a given workload if there's any spatial locality. But changing the size or associativity doesn't. Remember we're only talking about compulsory misses, not conflict or capacity misses.
I had to take a guess on what exactly you're mixed up on, but this might be it:
In a larger cache, it takes more misses to "fill" the cache (so most ways of most sets are valid). But that's not what compulsory misses counts. Compulsory doesn't mean misses that don't require evictions.
If you had a small that fills up quickly, it still counts as a compulsory miss when the workload touches a block it hasn't touched before, even if the cache has to evict something to make room for it. From the cache's perspective, a compulsory miss looks the same as a conflict or capacity miss. A cache itself can't tell the difference between capacity / conflict / compulsory misses.
A compulsory miss is one that increasing the size or associativity couldn't have avoided. You need to be able to keep track of the whole workload to determine that. A limited capacity cache of course can't do that, because that's not what it's for.
Upvotes: 1