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

Please explain. M not getting this.
retagged by

1 Answer

1 votes
1 votes

$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 !

Related questions

0 votes
0 votes
0 answers
1
Anshul kumar singh asked Jul 18, 2022
707 views
Quantify the effect on performance that results from the use of a cache in the case of a program that has a total of 500 instructions, including a 100-instruction loop th...
0 votes
0 votes
0 answers
2
Devshree Dubey asked Mar 19, 2019
503 views
Please can anyone help me how to measure the CPU Performance and everything related with it.
0 votes
0 votes
1 answer
3
gate_forum asked Jan 14, 2019
706 views
insufficient infop2p1
0 votes
0 votes
0 answers
4