in CO and Architecture retagged by
1,141 views
0 votes
0 votes
How this average access time derived ?
Tavg=hC+(1-h)M.

Please explain. M not getting this.
in CO and Architecture retagged by
1.1k views

2 Comments

please include more details. What is this equation about ? Is it about Cache Hit / Miss avg access time ?
0
0
Topic: Hit rate and miss penalty.(8.7.1)

Page No: 302

Book: hamacher 6th Ed.
0
0

1 Answer

1 vote
1 vote

$T_avg = hC+(1-h)M$

where,

$h$ : is the hit ratio of cache

$C$ : is the time to access cache

$1-h$ : is the miss ratio of cache

$M$ : is the time to access memory

Memory in a computer is organized in different hierarchies to speed up the access to memory. This memory are organized from small size (and fast access speed) to big size (slow access speed). A typical organization looks as below:

CPU first accesses Cache for getting the desired block of data. To do so, it takes $C$ unit of time. If the block (which CPU is looking for) is found, then such a scenario is called Cache hit. The search is complete at this point and block of data in cache is transferred to CPU (via bus). If, however, the block is not found in Cache, then such a scenario is called Cache miss. CPU will then try to access Memory for getting desired block of data.  To do so, it takes $M$ unit of time. Now the block of data would be found in the memory (yes it would be found, otherwise, if even there it is not found, then it is a different concept altogether i.e paging, which is currently out of scope of this discussion). 

Now, let me take one example:

Assume that there are 100 instructions which CPU has to execute which would need certain block of data from (cache / memory). Let us assume that cache would be hit for 80% of the instructions. This means for 80% of the instructions, the block of data would be found in cache. Let Cache access time be $10ns$. While for rest 20% instructions, the block of data would have to be taken from memory. Let memory access time be $100ns$.

So $80$ instructions would be executed in 

$80 * 10 = 800ns$

While, 20 instructions would be excuted in

$20 * 100 = 2000ns$ 

Total time take to execute $100$ instructions would be $2000 + 800 = 2800ns$

So, on an average an instruction would be executed in $2800 / 100  = 28ns$

Alternatively, using your formula

On an average, an instruction would take below amount of time to execute

0.8 (10) + 0.2(100)
8 + 20
28 ns

Hope this helps !

2 Comments

Yes. I am understanding the concept.

Few silly doubts remain.

-Why you took 100 in divisor while calculating average time taken by processor.

-paging concept is in os, same concept go further if data doesn't found in main memory ?

-in same way we do for calculating average time when two level cache is given ?
0
0

Why you took 100 in divisor while calculating average time taken by processor.

Because, the number of instructions in my case are $100$

Paging concept is in os, same concept go further if data doesn't found in main memory ?

If data is not found in main memory, and paging is enabled, it is called Page Fault (Like Cache Miss), In such case Secondary memory is accessed and page is brought to main memory.

in same way we do for calculating average time when two level cache is given ?

Absolutely. 

0
0