 # Operating systemGATE 2004

#1

Consider a system with a two-level paging scheme in which a regular memory access takes 150 nanoseconds, and servicing a page fault takes 8 milliseconds. An average instruction takes 100 nanoseconds of CPU time, and two memory accesses. The TLB hit ratio is 90%, and the page fault rate is one in every 10,000 instructions. What is the effective average instruction execution time?

#2

First Note all points given in the question in systematic order.

2-level paging
MainMemoryAccess (Ma) = 150ns
PageServiceTime (PST) = 8ms
TLB Hit rate ( q ) = 0.9
TLB Miss rate ( q’ ) = 0.1
Page Fault rate ( p’ )= 1/10,000

It’s also given that,
Effective Average Instruction Time = 100ns + 2*(Effective Memory Access Time) ----> eqn(i)

EffectiveMemoryAccessTime (EMAT) = (VirtualAddress To PhysicalAddress Translation) + (Time Taken for memory access)

= { Ttlb + q’ ( k*Ma ) } + { Ma + p’(PST) }

= { 0 + 0.1(2*150ns) } + { 150ns + (1/10000)(8ms) }

= 980 ns

Now from eqn(i),
Effective Average Instruction Time = 100ns + 2*(Effective Memory Access Time)

= 100ns + 2*(980ns)

= 100ns + 1960ns

= 2060 ns

#3

To fin frame number fro corresponding page number,at first TLB(Translation Lookaside Buffer)is checked whether it has that desired page number-frame number pair entry or not,if yes then it’s TLB hit otherwise it’s TLB miss.incae of miss the page number is searched into page table .in two-level programming scheme ,the memory is referred two times to obtain corresponding frame number.

If a vertual address has no valid entry in the page table,then any attempt by your programme to acess that virtual address will cause a page fault to occur.in case of page fault,the required frame is brought in main memory from secondary memory ,time taken to service the page fault is called page fault service time.

we have to calculate average execution time (EXE),lets suppose average memory access time to fetch is M,
then EXE=100ns+2*150(two memory references to fetch instruction)+M…1

now we have to calculate average memory access time M,since page fault is 1 in 10,000 instruction and then
M=(1-1/10^4)(MEM)+(1/10^4)*8ms…2

where MEM is memory access time when page is present in memory.now we can calculate MEM
MEM=.9(TLB Access time)+.1(TLB Access time+2*150ns)

here TLB access time is not givenlets assume it 0.so MEM=.9(0)+.1(300ns)=30ns,put MEM value in equation(2).M=(1-1/10^4)(30ns)+(1/10^4)*8ms=830ns

put this M’s value in equation (1),