in Operating System
3,322 views
3 votes
3 votes
Suppose: TLB lookup time = 20 ns

TLB hit ratio = 80%

Memory access time = 75 ns

Swap page time = 500,000 ns

50% of pages are dirty

OS uses a single level page table

What is the effective access time (EAT) if we assume the page fault rate is 10%? Assume the cost toupdate the TLB, the page table, and the frame table (if needed) is negligible.

1. 3777.5ns

2. 30220ns

3. 15110ns

4. 7555ns
in Operating System
3.3k views

4 Comments

yes , check ans
0
0
The flow should be like this:

If(TLB hit) Fetch the block from the main memory

If(TLB miss)
  {
    Check the page table for the frame number
    If there is no page fault
    {
      Go to the memory and get the word
    }
     If there is a page fault
      {
         Memory will be accessed twice
         If the page is dirty
         Swapping will take place twice
         If the page is not dirty
         Swapping will take place once
      }

  }
    

So, final answer is:
0.8 (20+75) +
0.2 (20 + 0.9(75+75) + 0.1(2*75 + 0.5*500000 + 0.5*2*500000)

= 15110 nanoseconds
3
3
why we need 2 time memory access in case of page fault?

1 for searching that page in not present in the memory and other for what?
0
0

2 Answers

6 votes
6 votes
Best answer
TLB lookup time = $20$ ns

TLB hit ratio = $80$%

Memory access time = $75$ ns

Swap page time = $500,000$ ns

$50%$ of pages are dirty

Page Fault rate =$10$%

When there is a TLB hit, we no need to consider page fault,moreover here is no requirement of page translation. Because that information not given in question.

When TLB miss is occured then only we need to check, if there is a page fault or not

if there is a page fault, we need to consider, page fault service time

So,

TLB hit(TLB access time)+TLB miss(no pagefault*MM access time+pagefault(dirty page*PFST+no dirty page*2*PFST))

=$0.8(20+75)+0.2[0.9(20+75+75)+0.1(0.5\times 500000+0.5(2\times 500000))]$

=$0.8\times 95+0.2[153+0.1(250000+ 500000))]$

=15106.6ns
selected by

19 Comments

But here it is already given that the OS uses single level page table. Moreover, if we don't need to perform any address translation, then why do we need to look up into the TLB?
0
0
I havenot consider 2 level Page table anywhere

TLB lookup time is simply TLB access time here
0
0
reshown by
Oh.ok..thanks srestha :)
0
0

srestha mam at the time of page fault why are not considering the tlb access time because after accessing tlb we came to know there is page fault and then after servicing that page fault our desire page will be in page table so then why we are not considering the memory time after accessing the pagetable??

doubt 2 why u are doing 2*pfst incase of no dirty page?? 

0
0
TLB and memory access time are negligible as compared to the page fault service time.

Yes even I think it will be 2*pfst for dirty page and only pfst when page isn't dirty.
0
0
so we can consider them ?? and actual procedure is like considering them in case they both are nearly same??

and why to consider 2*pfst in any case and for non dirty page we can simply use given pfst becz nothing is mentioned in question?
0
0
If the page is dirty, then before replacing it from the main memory, the page has to be swapped in and written back into the disk. After writing back to the disk, then only the required page can be fetched from the disk (i.e. swapped out of disk) and then placed in main memory where the dirty page resided previously. Hence, if the page is dirty, it requires two swaps. Therefore page fault service time in case of dirty page is 2*0.5*500000.

And yes you generally consider the memory access time and tlb access time in case of page fault. But you can omit it also if it is negligible as compared to page fault service time.
4
4
no need to consider

because PFST means  already contain MM access time+Servicing PF time

So, donot consider them individually
0
0
But in cases where we need to perform address translation, then when a page fault occurs, after fetching the page into the main memory from the disk, we need to again access the tlb and in case of miss in TLB, we need to go to the memory for accessing the page table and finally access the memory one more time to access the required word.

So in this case, does page fault service time include all of these times? i.e. one TLB access time+2 memory access times?
0
0
i am not asking about  "again we need to access the tlb"

i am saying we got to know that we are having pagefault in page table and we are comm=ing to pagetable after accessing the tlb because there is miss in tlb so we came to pagetable  and here we serivice the pagefault and then go to memory to take frame .......and in case of pagefault mm access tyme is included in pfst but how in case of address translation?
0
0

Somoshree Datta 5

Can u show me any standard question like GATE ,where page fault service time considered and with that MM access time considered separately in case of Page Fault?

0
0

https://github.com/rover10/OS/blob/master/test2.txt

Look at question number 9(c). Here they have considered the tlb access time and the memory access time separately after page fault. How to solve these types of questions then?

Here, if we consider memory access time and tlb access time included within page fault service time, then the answer should be: 0.7*(10ns+200ns)+0.2*(10ns+200ns+200ns)+0.1*(10ns+200ns+100ms). Isn't it?

0
0

Somoshree Datta 5

where there is any page fault service time?

It is not mentioned in that question

0
0

Isn't 100msec the page fault service time???what is it then? Since it is explicitly mentioned that "context switching,disk transfer time" so we are not considering the memory access time and tlb access time included within this time..am I right?

 

0
0
it is context switch time , not PFST
0
0
ok..got it now..thank you :)
1
1

 lookat this answer of Kapil sir  in  (B)  ,memory access time is included after servicing the page ,because swap time doesnot include memory access time ,you have to include that also.

0
0

@srestha

You have applied different logic to solve same type of problem.

See it. https://gateoverflow.in/110724/demand-paging

Which approach is right? Please help. I'm too much confused about this topic.

0
0
when there is dirty page it should be 2 *PFST
0
0
0 votes
0 votes

main confusion here is , there are two approaches or say formula in case of page fault with TLB 

that are – 

1 ) EAT = TLB hit(TLB access time) +TLB miss(no pagefault*MM access time+pagefault(dirty page*PFST+PFST))

2 ) EAT = No Page Fault(TLB hit+TLB miss)+ Page Fault (TLB hit+TLB miss+ Page swap time)

here, first formula assume that there is no page fault in case TLB hit and second formula assume that there will be page fault independent from TLB hit or TLB miss

the fact is TLB hit doesn't mean that corresponding page is in main memory. Page fault can still occur

source- https://stackoverflow.com/questions/6398811/can-a-tlb-hit-lead-to-page-fault-in-memory#:~:text=Page%20fault%20can%20still%20occur,page%20available%20in%20main%20memory.&text=On%20a%20TLB%20miss%20kernel,t%20lead%20to%20page%20fault.

clearly means that first approach is wrong so go with second formula, i have also checked on some other platform they have also used the second one like https://www.gatevidyalay.com/page-fault-paging-practice-problems/

now coming to dirty pages-

we only have to swap in pages in case of page fault(and replaced page is not dirty) 

but we also have to swap out in case of dirty page and then swap in the required page 

source – https://gateoverflow.in/77917/testbook-os-test

means in case of dirty pages the formula becomes-

EAT=No Page Fault(TLB hit+TLB miss)+ Page Fault (TLB hit+TLB miss+ Page swap in time + dirty pages x page swap out time)

​​​​​​​hope it helps 

3 Comments

so acc to you the formula should be

EMAT= C + (1-x)(n*M) + p(PFST) +M

Where C = TLB access time

           x= tlb hit ratio

          M = Main memory access time

          p =page fault rate.

          n = level of paging
0
0
Yes , In many places second formula is used. So we should apply that to evaluste EMAT right ?
1
1
yeah! i cleared my doubt through many examples and other sources,so i recommend using the formula i mentioned in my answer
1
1