For example, if it takes 1 cycle to read the cache and 3 cycles to write the cache, is the hit time equal to 4 cycles? Also, does this vary based on whether the cache is an instruction cache or a data cache?

  • 1
    $\begingroup$ a "hit" occurs when either a read or a write (or both) occurs and the associated address range is inside of a cache line in cache already. A "cache hit" takes no time. A cache miss takes time. I believe it to be the case that a miss for a read or a write will be very close to the same on modern cores since either way they both move data from one layer up to one layer down. $\endgroup$
    – Jake
    Commented Apr 29, 2022 at 17:46
  • 2
    $\begingroup$ Define “cache hit time”. $\endgroup$
    – gnasher729
    Commented Sep 29, 2022 at 6:24

1 Answer 1


I would say, it depends.

Overall there are several strategies how a cache could be incorporated into a process. Few of these options are:

  • read through: a client reads from cache, and if the cache does not have a value, then the cache itself reads the data from the store. And the cache saves the value before being returned to a customer. In this case the cost will be vary, depending if the value is already in cache.
  • cache aside is another option - the client checks the cache - the cache either gives back the value or returns nothing. If the value was not found, it's the client who goes to datastore to read and also write to the cache.

There are few more strategies, and all of them will have a different cost.

Also, it is important to understand what "cache hit" and "cache miss" is. These are term unrelated to the way how cache is integrated. By definition, a cache hit happens when a client requests a key, and the key is already in the cache, regardless how that key got there. "Cache miss" is opposite - a client asks for the key, and the key is not there.


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.