edited by
33,336 views
108 108 votes
Consider a computer system with ten physical page frames. The system is provided with an access sequence $(a_{1}, a_{2},....,a_{20}, a_{1}, a_{2},...a_{20})$, where each $a_{i}$ is a distinct virtual page number. The difference in the number of page faults between the last-in-first-out page replacement policy and the optimal page replacement policy is_________.

9 Answers

Best answer
100 100 votes
Answer is $1$.

In LIFO first $20$ are page faults followed by next $9$ hits then next $11$ page faults. (After $a_{10}$, $a_{11}$ replaces $a_{10}, a_{12} $ replaces $a_{11}$ and so on)

In optimal first $20$ are page faults followed by next $9$ hits then next $10$ page faults followed by last page hit.
edited by
110 110 votes

the answer is $31-30=1$

edited by
9 9 votes

In LIFO last access page will be replaces first

In LIFO we replace Last access page  First . As here First put a1 , then a2.......then a10 . As here 10 frames. Now replaces a10 with a11 to a20.

Now we are getting a1 to a9 hit as those are already in first 9 frames. Next a10 will be replace a9 as it is last access frame. And others will replace a10 , a11 will replace a10...........So, a20 will be hit .

Same with optimal too 

5 5 votes
YES as you see the que and start solving it you will get the illusion that answer is 0 but if solve question fully...answer will come 1.
4 4 votes

Correct Answer : 1.

LIFO Page Faults ==> 20 + 11 = 31

OPTIMAL Algo Page Faults ==> 20+10 = 30

Difference between {LIFO , OPTIMAL} Page Faults = 31-30 = 1.

Second Approach:

Difference Between Total Hits.

Hits in LIFO = 1.

Hits in OPTIMAL Algo = 1+1 = 2.

Difference between {LIFO , OPTIMAL} Page Faults = 2-1 = 1.

3 3 votes
It can also be solved taking a smaller example like 1,2,3,4,1,2,3,4.

Here we can consider the number of physical page frame as 2.

Thus in LIFO, it comes out to be 7 page fault and in Optimal it is 6.

Hence difference is 7- 6 = 1.
Answer:
Position:
Show:

Related questions

67 67 votes
6 answers 6 answers
31.8k
31.8k views
Sandeep Singh asked Feb 12, 2016
31,779 views
Cylinder a disk queue with requests for $I/O$ to blocks on cylinders $47, 38, 121, 191, 87, 11, 92, 10.$ The C-LOOK scheduling algorithm is used. The head is initially at...
71 71 votes
8 answers 8 answers
25.1k
25.1k views
Sandeep Singh asked Feb 12, 2016
25,123 views
Consider an arbitrary set of CPU-bound processes with unequal CPU burst lengths submitted at the same time to a computer system. Which one of the following process schedu...
90 90 votes
10 answers 10 answers
38.3k
38.3k views
Sandeep Singh asked Feb 12, 2016
38,263 views
Consider the weighted undirected graph with $4$ vertices, where the weight of edge $\{i,j\}$ is given by the entry $W_{ij}$ in the matrix $W$. W=$\begin{bmatrix} 0&2 &8 &...
117 117 votes
21 answers 21 answers
55.5k
55.5k views
Sandeep Singh asked Feb 12, 2016
55,501 views
Let $G$ be a complete undirected graph on $4$ vertices, having $6$ edges with weights being $1, 2, 3, 4, 5,$ and $6$. The maximum possible weight that a minimum weight s...