TLB hit rate=90%
TLB access time=1ns
Main memory access time=100ns
page fault rate=20%
Page fault service time=20 ms
2 level paging is used
Find out the effective memory access time.
General concept:
effective memory access time= time taken to convert VA to PA + time taken to fetch the byte from memory.
VA->PA : (0.9)(1)+(0.1)(1+2*100)
For fetching the byte from memory:(0.8)(100)+(0.2)(20x10^6)
Effective memory access time=(0.9)(1)+(0.1)(1+2*100) + (0.8)(100)+(0.2)(20x10^6)
=0.9+20.1+80+4000000
=4000101 ns
=4.000101 ms
My idea:[ This is the same idea incase of TLB and Main memory only without pagefault]
Effective memory access time=(0.9)[1+100] + (0.1)[1+2*100+(0.8)(100)+(0.2)(20x10^6)]
=90.9 + 0.1(201+80+4x10^6)
=90.9 + 400028.1
=400119 ns
=0.4 ms
My idea explanation :
(0.9)[1+100] = whenever there is TLB hit,we can find the frame number from TLB and exactly 1 main memory
access is required to fetch the byte.There is no page fault when there is TLB hit
(0.1)[1+2*100+(0.8)(100)+(0.2)(20x10^6)] = whenever there is TLB miss, we need to access the main memory twice
to get the frame number(2 level paging is used) if it present in
the Main memory and 1 Main memory access is required to fetch the
byte. Otherwise we need to access the secondary memory.
we are getting two different answers.
I want to know which answer is correct.
If my idea is wrong why it is wrong?