edited by
1,254 views
4 votes
4 votes


@arjun sir please see this
________________________________________________________________________________________
if picture is not clear
consider a 2 level memory hierarchy L1(cache) has an accessing time of 20ns and MM has accessing time 40nsec. writing or updating contents into their memory takes 40nsec.. and 50nsec for L1 and L2 respectively.assume L1 gives misses 65% of the time. the average writing time if it uses write through technique____
________________________________________________________________________________________
 main memory is updated in any case so shudnt it be 50ns only?
i dont think we shud care abt hit ration in such case

edited by

2 Answers

Best answer
5 votes
5 votes

This question is asking about Average writing time for Write-Through technique ...In write through Technique, cache write / update and memory write/ update is done paralley means both have done at the same time  ( parallely)  .

Now, H = hit rate in cache
Tc = cache access time
Tm = memory access time

H= 35%
Tc= 20  and   Tm = 40
writing / updating time into memory = 50

so formula is
T avg write time = H * T memory update time + ( 1-H) * ( T memory update time )

= 0.35 * 50 + 0.65 * (  50 )
= 17.5 + 32.5
= 50 

When cache miss occurs , in Write Through it use Write No-Allocate policy, in Write No-Allocate Missed main memory block is updated while residing in the Main memory itself and NOT brought to the cache.

That's why we need to consider Memory update time only when cache miss.

 In Write - Through Technique , every write operation to the CACHE is repeated to the main memory AT THE SAME TIME. 



Write-Through Technique use Write No Allocate Policy . Where the missed Main memory block is updated while residing in the main memory and not brought to the cache. 
so for this problem formula used is :

TAverage writing time = H * T mem update time + ( 1 - H ) * ( T mem update time ) .

// In this question  all the data given is not required .

And we don't need extra search time as it is clearly mention in the question that " consider a 2 level memory hierarchy " . Means if miss in cache then surely found in main memory .

So the question implicitly assumes that all the blocks required are contained within the main memory,  we NO need to check whether a block exists or not because, if it doesn't exist then we have to go to secondary storage but that is not mentioned in the question , in question only 2 level memory hierarchy is given .

edited by
2 votes
2 votes

L1 cache miss chances = 65%

L1 cache hit chances = 100-5 = 35%

TavgW = 0.35*TMemUpdate + 0.65*(TMemUpdate) = 0.35*50 + 0.65*(50) = 50 nsec

Since only 2 levels of memory is given no need to consider check time in main memory

Answer:

Related questions

1 votes
1 votes
1 answer
1
gari asked Jan 11, 2018
527 views
my doubt1) default is hierarchal or simultaneous.2)will we use hierarchical or simultaneous here..also explain.
2 votes
2 votes
0 answers
2
Shubhanshu asked Aug 5, 2017
784 views
According to my calculation, the time required in write back is 240ns and for write through it should be 1920ns. Is it correct or not?