0
$\begingroup$

I am trying to understand how to approach the question below which is a coursework question. I understand that each memory request is 32 bits and so there will be 262144 requests. There are 42 blocks in the cache. I am not sure how to think about this in terms of cache hits and misses. Is this question even well defined? I cannot see how to use the caching strategy as a fact that would help trying to figure out the expected hit ratio, so I must be missing something fundamental. I don't expect an answer, obviously, but it would be helpful a hint on how to approach it as I am totally lost.

Consider a machine with a single cache between the CPU and main memory, where the cache consists of 128 KB that is divided into blocks of size 3 KB, and the size of main memory is 4 GB. Assume that we start with an empty cache (i.e, all blocks are unoccupied) and that the CPU is going to iterate from beginning to end over an array that is 1 MB large. Moreover, assume that the caching strategy is simply to replace the oldest block in case of a cache miss. Assume that the CPU reads 32 bits at each memory request. What is the expected hit ratio for the cache while the CPU is reading the array from main memory?

$\endgroup$
3
  • $\begingroup$ (128 KB [divided into blocks of] 3 KB ?!) $\endgroup$
    – greybeard
    Commented Mar 7 at 22:33
  • $\begingroup$ @greybeard I had the same reaction, 3 is not a divisor of 128. $\endgroup$
    – Euridice
    Commented Apr 9 at 13:58
  • $\begingroup$ OTOH, 3*42 is close to 128. (Wait - is it crystal clear 3KB is kbytes, not kbits?) Starting empty, the first read is a miss. When will the 2nd miss occur? The 3rd? Does the cache size make any difference? What about instruction/code accesses? $\endgroup$
    – greybeard
    Commented Apr 9 at 14:33

0

Your Answer

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

Browse other questions tagged or ask your own question.