7,832 views
6 6 votes
Consider a paging system which stores its two-level page table in memory and its 16 most recently referenced entries in a TLB. If, a memory access takes 80 nsec, a TLB lookup takes 20 nsec and a page swap time takes 5000 nsec, how long does a data item take to access if the TLB hit rate is 95% and the page fault rate is 10% ?

3 Answers

Best answer
16 16 votes

TLB hit rate is 95%

page fault rate is 10%

memory access takes 80 nsec

TLB lookup takes 20 nsec 

page swap time takes 5000 nsec

A). Average memory access time = AMAT =>

=> Probabilty of no Page fault (....................)  +  Probabilty of Page Fault (.....................)

=> $0.90 * \left ( 0.95 * ( 20 + 80) + 0.05 * (20 + 80 + 80 + 80) \right ) + 0.10* (0.95 *(20 + 80 ) + 0.05 * (20 + 80 + 80 +80) + 5000)$

=> 97.2 + 510.8 

=> 608 ns


OR


B). Average memory access time = AMAT =>

=> $\left ( 0.95 * 20 + 0.05 * (20 + 160) \right ) + \left ( 80 \right ) + 0.1 * 5000$

=> 19 + 9 + 80 + 500

=> 608 ns


OR


C). Average memory access time = AMAT => 

=> TLB hit (................)  + TLB miss (...................)

=> $0.95 * \left ( 20 + 0.90 * 80 + 0.10 * (80 + 5000) \right ) + 0.05 (20 + 80 + 80 + 0.90* 80 + 0.10(80 + 5000))$

=> 570 + 38 

=> 608 ns

PS:--> In Last Method, (80 + 5000) is done because 5000 ns is just like disk access time as given in the question. If it had been given that page fault service time is 5000 ns, then use only 5000 ns inplace of (5000 + 80), as PFST includes memory access time also.

• edited by
8 8 votes

Given , page fault service time (here referred to as page swap time since 

           majority of page fault service time is in swap only , other task include like page replacement from

           the main memory , updation of page tables etc)      = 5000 ns

           page fault rate             =  10%  =  0.1

          TLB access time          =  20 ns

          TLB hit rate                  =  95 %  = 0.95

         Main memory access time  = 80 ns

Let us break the solution into subproblems .

Case 1 : Page fault does not occur

This has further cases :

a) TLB hit occurs :

So effective time when TLB hit occurs = TLB hit rate*  [TLB access time + Main memory access time ]

                                                        =  0.95 * [20 + 80]

                                                        =  0.95 * [100]

                                                        =  95 ns        ............(1)

Now 

b) TLB miss occurs :

So in this case the page tables access time which are in main memory are also going to be counted .Since it is given that 2 level paging is used , so 2 main memory access times are required since page tables are stored in main memory. 

So effective time when TLB miss occurs = TLB miss rate*  [TLB access time + 2 main memory access time(due to page table)                            + 1 main memory access time to read the actual data / instruction ]

                                                           = 0.05 * [20 + 80 + 80 + 80]

                                                           = 0.05 * [260]

                                                           = 13  ns                                                    ...............(2)

So combining (1) and (2) ,

 Effective time if page fault does not occur  =  95 + 13

                                                               =   108 ns                                                   .................(3)

Now we come to case 2) 

Case 2  : Page fault occurs :

If page fault occurs , then in addition to what have we done in earlier steps , we also require page fault service time

So time required in this case :  Page fault service time + effective time calculated in case a) [as we come to know later that page fault has occured , so we have accessed TLB , page tables , main memory as required and as the case may be before knowing that page fault has occured ]

So ,

Time required in case page fault occurs     =     5000 + 108

                                                              =     5108 ns                    ...............(4) 

But page fault occurs only 10 % of the time.Hence,

Effective time required         =      Page hit rate * time calculated in case 1 + page fault rate(or miss rate) * time found in case 2

                                          =      0.9 * 108  +   0.1 * 5108

                                          =      608 ns

                                     

Hence time required effectively  = 608 ns

0 0 votes

EMAT=Effective memory access Time

EMAT=page fault rate(Service time+memory access Time) +hit rate(TLB hit(TLB access Time+memory acess Time)+TLB miss(TLB access Time+no. of page table*memory acess Time+ memory access Time));

page fault rate=10%

Service time=5000ns

memory access Time=80ns

0.1*(5000+80)+0.9(0.95(20+80)+0.05(20+80+80+80))=605.2

• reshown by
Position:
Show:

Related questions

0 0 votes
1 1 answer
131
131 views
DΛΞMON asked Sep 9
131 views
\begin{aligned}&\text { Q. Which of following is/are true statements. }\\&\text { A) Suppose we have } 3 \text { process P0 P1 P2 and we want to run all concurrently then...
6 6 votes
2 2 answers
291
291 views
GO Classes asked Aug 31
291 views
Which of the following data structures can be used by a file system to manage free disk blocks?Bitmap Inode Free-block linked list File Allocation Table, FAT I and II onl...
5 5 votes
1 1 answer
200
200 views
GO Classes asked Aug 31
200 views
A segmentation-based memory-management system maintains a shared segment table.Processes $P_1$ and $P_2$ both share segment $S$.Which of the following statements is incor...
3 3 votes
2 2 answers
220
220 views
GO Classes asked Aug 31
220 views
Suppose $\texttt{x}$ is a condition variable inside a monitor.What happens when a process executes:$\texttt{x.wait()}$Mutual exclusion is established on variable $\texttt...