edited by
1,686 views
4 votes
4 votes

A computer system with 2 level paging scheme in which regular memory access takes 300 nanoseconds and servicing a pagefault takes 500ns. An average instruction takes 200 ns of CPU time and one memory access. The TLB hit ratio is 80% and page fault ratio is 20%. The average instruction execution time is ?

My answer is 660 ns but made easy solution has 580 ns.
Can any one check??

edited by

1 Answer

Best answer
9 votes
9 votes

Average Instruction execution time

 => Average CPU execution time + Average time for getting data from memory

 => Average CPU execution time + Average address translation time for each instruction  + Average memory fetch time / access       time  for  each instruction + Average page fault time for each instruction

 => 200 + 1( 0.8 * 0 + 0.2 * (2 * 300))  +  1 * 300 + 0.20 * 500 ns

(ONE memory access per instruction and  hence we need 1 * address translation time for average instruction execution time)

(TLB access time assumed as 0 and 2 page tables need to be accessed in case of TLB miss as the system uses two-level paging )

=> 200 + 120 + 300 + 100

=> 720 ns

OR

By another Method :-->

=> 200 + No page fault (....... Memory access........) + page fault (....... Page Fault Service Time........)

=> 200 + 0.80 { 0.80 ( 0 + 300 ) + 0.20 (0 + 300 + 300 + 300)} + 0.20 {0.80 ( 0 + 300 ) + 0.20 (0 + 300 + 300 + 300)  + 500 }

=> 720 ns



One issue here is "does page fault service time include memory access time". Quite often it does, though practically that is insignificant. But here, the values are storage - 500ns for a page fault is unbelievable. For GATE, this should not happen, still keep in mind that sometimes, this can happen in which case for memory access time - we have to neglect the pagefault case. (both for translation as well as access)

=> 200 + 0.80 { 0.80 ( 0 + 300 ) + 0.20 (0 + 300 + 300 + 300)} + 0.20 { 500 }

=> 636ns.


Do this Method only as a second option in case option does not match as your method should give the expected answer in GATE. For these kind of questions I'm sure no numerical answer will be there and hence a little adaptability must be taken based on choices. 

edited by

Related questions

0 votes
0 votes
1 answer
1