2
$\begingroup$

I know how to calculate the CPI or cycles per instruction from the hit and miss ratios, but I do not know exactly how to calculate the miss ratio that would be 1 - hit ratio if I am not wrong. I know that the hit ratio is calculated dividing hits / accesses, but the problem says that given the number of hits and misses, calculate the miss ratio.

My reasoning is that having the number of hits and misses, we have actually the number of accesses = hits + misses, so the actual formula would be:

hit_ratio = hits / (hits + misses)

So the miss ratio would be

miss_ratio = 1 - hit_ratio

If my reasoning is correct, right?

What is the hit and miss latencies? Because I need them to calculate the mean access time using the hit and the miss ratios and the hit and the miss latencies (in cycles)...

$\endgroup$
1
$\begingroup$

Yes. The hit ratio is the fraction of accesses which are a hit. The miss ratio is the fraction of accesses which are a miss. It holds that $$ \text{miss rate} = 1-\text{hit rate}.$$

The (hit/miss) latency (AKA access time) is the time it takes to fetch the data in case of a hit/miss. If the access was a hit - this time is rather short because the data is already in the cache. But if it was a miss - that time is much linger as the (slow) L3 memory needs to be accessed. The latency depends on the specification of your machine: the speed of the cache, the speed of the slow memory, etc.

$\endgroup$
  • $\begingroup$ Can you show me a simple example of how would you calculate the mean access time having of I told you? $\endgroup$ – nbro Nov 2 '14 at 9:15
  • $\begingroup$ mean access time == the average time it takes to access the memory. If it takes X cycles for a hit, and Y cycles for a miss, and 30% of the time is a hit (thus 70% is a miss) -> what is the average (mean) time it takes to access ?? $\endgroup$ – Ran G. Nov 2 '14 at 14:26
  • $\begingroup$ Well, we know that $X * 0.30$ is the total number of cycles where we have a hit, and that respectively $Y * 0.70$ is the total number of cycles where we have a miss, therefore the total number of cycles is the sum of both: total_number_of_cycles = $X * 0.30$ + $Y * 0.70$. But we still not have an average of something, we need to divide it for the total time: mean_access_time = total_number_of_cycles / 1.0 , Is it right? $\endgroup$ – nbro Nov 2 '14 at 15:10
  • $\begingroup$ @RanG. Can you take a look at my caching hit/miss question? cs.stackexchange.com/questions/43235/… $\endgroup$ – committedandroider Jun 4 '15 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.