2
$\begingroup$

Long time lurker, first time poster. The book I am reading is William Stalling's "Operating Systems: Internals and Design Principles" Seventh Edition.

Stalling's definition of hit ratio according to the book is thus: "the hit ratio is defined as the fraction of all memory accesses that are found in the faster memory."

One of his questions is that given a memory system with a cache memory access time of 100 nanoseconds and a main memory access time of 1,200 nanoseconds; "If the effective access time is 10% greater than the cache access time, what is the hit ratio H?"

I have already found an answer online after attempting this question myself,

(0.10 x 100) = (1-H)1200

However, I was wondering if someone could explain two things:

  1. Where did this formula come from? (I have searched the chapter prefacing this question and, so far, Stallings has not derived or discussed any formulae.)

  2. Why is it 0.10 x 100? If the effective access time is 10% greater than the cache access time, would it not be 0.90 x 100? As 10% faster would be 10 nanoseconds less, not 10 nanoseconds total.

Pre-post edit: Looking through other threads I noticed that the miss ratio is 1 - hit ratio (which is logical). Staring at the answer I found for a minute afterwards brings me another question: Is the formula that was used to answer this stating that the effective access time of the fastest memory is equal to the effective access time of the slowest memory?

Edit: After digging around in StackExchange and Google, I found an excerpt from Silberschatz that deals similarly with this problem.

Given his formula:

effective access time = H*cache access time + (1-H)*main memory (in this case)

Using values from the above problem:

1.10*cache access time = H*cache access time + (1-H)*main memory access time

Substituting real numbers:

1.10*100 = H*100 + (1-H)*1200

Solving finds 1090/1100 or H to be approximately .9909, giving a hit ratio of approximately 99.1% Close to the "found" answer online, but I feel a lot better about this one.

$\endgroup$
  • $\begingroup$ from where you get the formula: effective access time = H*cache access time + (1-H)*main memory (in this case). I feel even that is wrong. When TLB hit occurs, we access actual page from main memory. When TLB miss occurs, we access page table from main memory and then actual page from main memory. So $T_e=H*(T_c+T_m)+(1-H)*(T_c+2T_m)$. And this is from Galvin's book only, though he does not give direct formula. He solves it this way. (6th edition, page 294, on the page containing figure 9.10) $\endgroup$ – anir Jun 9 '16 at 17:09

Your Answer

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

Browse other questions tagged or ask your own question.