@adarsh_1997 could you please help! where m i going wrong?

Dark Mode

410 views

1 vote

A cache memory is 30 times faster than main memory (MM) and 50% of the time cache is referred for the execution of instruction. The performance is gained by introducing this cache is ________.

What I did

EMAT = 0.5(M/30)+0.5(M/30+M) = 32M/60

speed up= (M)/32M/60)

=60/32=1.875

answer given is 1.90-1.97 (using amdhal’s law)

What I did

EMAT = 0.5(M/30)+0.5(M/30+M) = 32M/60

speed up= (M)/32M/60)

=60/32=1.875

answer given is 1.90-1.97 (using amdhal’s law)

0 votes

Best answer

Initially I was also getting 1.88.

Then I realized memory is accessed twice [Taking a general case] , so I approached it differently .

Let time to access main memory = x units

So time to access cache = x/30 [Since 30 times faster]

In non cache environment , total time of memory access for 1 instruction = 2x

In cache environment :-

For instruction = 1/2[x/30] +1/2x

For 2nd memory operation = 1/2[x/30] +1/2x

Therefor total time in cached environment = x/30 + x units

Performance gain = 2x / (x/30 + x units) = 60/31 = 1.94

Then I realized memory is accessed twice [Taking a general case] , so I approached it differently .

Let time to access main memory = x units

So time to access cache = x/30 [Since 30 times faster]

In non cache environment , total time of memory access for 1 instruction = 2x

In cache environment :-

For instruction = 1/2[x/30] +1/2x

For 2nd memory operation = 1/2[x/30] +1/2x

Therefor total time in cached environment = x/30 + x units

Performance gain = 2x / (x/30 + x units) = 60/31 = 1.94

0 votes

Suppose main memory access takes $t_m$ and cache access takes $\frac{t_m}{30}$ as it is 30 times faster.

when the cache was not there, access took $t_m$ time.

now when the cache is introduced it takes $0.5\frac{t_m}{30}+0.5t_m =\frac{t_m}{60}+\frac{t_m}{2}$

Now speed up will be $\frac{earlier\ time}{new\ time}$

$=\frac{t_m}{\frac{t_m}{60}+\frac{t_m}{2}}$

$=\frac{t_m}{\frac{t_m+30t_m}{60}}$

$=\frac{t_m\times60}{31t_m}$

$\frac{60}{31}=1.93$

when the cache was not there, access took $t_m$ time.

now when the cache is introduced it takes $0.5\frac{t_m}{30}+0.5t_m =\frac{t_m}{60}+\frac{t_m}{2}$

Now speed up will be $\frac{earlier\ time}{new\ time}$

$=\frac{t_m}{\frac{t_m}{60}+\frac{t_m}{2}}$

$=\frac{t_m}{\frac{t_m+30t_m}{60}}$

$=\frac{t_m\times60}{31t_m}$

$\frac{60}{31}=1.93$

0

0

0 votes

let x be a factor, when multiplying with the x we will get the actual memory reference time;

effective time before cache was introduced = 1 x (30 x) = 30x

effective time after cache is introduced = 0.5( 1 x) + 0.5 ( 30 x) = 15.5x

since 50% time it is referencing cache.

performance gain = 30x /15.5x = **1.93**