edited by
1,297 views
0 votes
0 votes
Quantify the effect on performance that result from the use of a cache in the case of a program that has a total of $500$ instruction including a $100$ instruction loop that is executed $25$ times.Determine the ratio of execution time without the cache to execution time with the cache.Assume that main memory access require $10$ units of time and cache access require $1$ unit of time.We also make the following assumption

1)Program execution time is proportional to the total amount of time needed to fetch the instruction from either the main memory or the cache.with operand data access being ignored

2)Initially all instruction is stored in main memory and the cache is empty.

3)The cache is large enough to contain all loop instruction.

_________________________________________________________________

my solution is

execution time without cache is=$400*10+100*10*25=29000$

execution time with cache =$500*10+100*1*25=7500$,

but in  original solution execution time with cache is =$500*10+100*1*24=7400$.

my doubt is loop is occuring $25$ times so why there is multiplication of $24$ ??why not $25$??
edited by

1 Answer

1 votes
1 votes
It is so because for the first time, 100 instructions will be fetched from the main memory, that requires 10 units of time and after that stored in cache and so for the next 24 times, 1 unit of time will be required.

Related questions

0 votes
0 votes
0 answers
3