Deprecated: Implicit conversion from float-string "1544909659.869" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1544909659.869" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1544909659.869" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1544909659.869" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1544909659.869" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 594

Deprecated: Implicit conversion from float-string "1544929436.862" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1544929436.862" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1544929436.862" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1544929436.862" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1544929436.862" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 594

Deprecated: Implicit conversion from float-string "1544928791.036" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1544928791.036" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1544928791.036" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1544928791.036" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1544928791.036" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 594
OS Optimal Page replacement / GATE Overflow for GATE CSE
494 views

2 Answers

Best answer
2 votes
2 votes
In the first pass of the string, there will be $15$ page faults.

$Number\,of\,page\,faults = 15$

There are 8 page frames, using optimal the values would be : $1|2|3|4|5|6|7|15$

On the second pass of the string, there is no page fault until $7$ as $8$ comes it will replace $7$, $9$ will replace $8$, this process continues until $14$ and at $15$ there is no page fault.

$Number\,of\,page\,faults = 15 + 7$

The page frames are : $1|2|3|4|5|6|14|15$

In the third pass of the string, there is no page fault until $6$ as $7$ comes it will replace $6$ this process continues until $13$ and at $14$ and $15$ there is no page fault.

$Number\,of\,page\,faults = 15 + 7 + 7$

The page frames are : $1|2|3|4|5|13|14|15$

In the fourth pass of the string, there is no page fault until $5$ as $6$ comes it will replace $5$ this process continues until $12$ and at $13$, $14$ and $15$ there is no page fault.

$Number\,of\,page\,faults = 15 + 7 + 7 + 7 = 36$

The page frames are : $1|2|3|4|12|13|14|15$
selected by
2 votes
2 votes

We are given 8 page frames and the requests are as:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15.

Optimal Page Replacement Algo states that whenever a page has to be swapped out we swap out a page whose occurence is farthet in the memory.

So as we are given 8 page frames and the string is repeated 4 times then :

Request String becomes:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15.

1 2 3 4 5 6 7 8

As initially the page frame is empty page faults:8

Now when 9 comeas page 1 to 7 wont be flushed out only the last page will be flushed out till 15 So Page faults=8+7=15

 

1 2 3 4 5 6 7 15

 

There will be no page faults for 1 to 7. When 8 comes 7 will be flushed out(it would be referred the farthest look at the given string).

So everytime this cell will be used So now page faults are :15+7(i.e 14-8+1)=23.

1 2 3 4 5 6 14 15

 

Now no page faults for 1,2,3,4,5 and 6. When 7 comes page fault start occuring and the cell with value 6 will always be replaced. So page fault occur for 7,8,9,10,11,12,13. No of page faults=23+7=30

Now the table is:

1 2 3 4 5 13 14 15

 

Page fault occurs for: 6,7,8,9,10,11,12 i.e 6 pages Total no of page faults=30+6=36

Hence total no of page faults=36

Related questions


Deprecated: Implicit conversion from float-string "1547532407.746" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1547532407.746" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1547532407.746" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1547532407.746" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803
1.0k
views
1 answers
1 votes
Xylene asked Aug 11, 2017
1,047 views
Consider page references, 1,2,3,5,2,3,4 and number of frames = 3.In the end will the frame contain 4,2,3 or 5,4,3 ?
915
views
0 answers
6 votes
Rishabh Gupta 2 asked Nov 26, 2017
915 views
Strangely, if we let $S^R$ be the reverse of a reference string S, then the page-fault rate for the OPT algorithm on S is the same as the page-fault rate for the OPT algo...
535
views
0 answers
0 votes
Jyoti Kumari97 asked Jan 15, 2019
535 views
Assume there are 5 frames and consider the following reference string find the number of page faults using NRU page replacement algorithm.3,2,3, 0,8,4,2,5,0,9,8,3,2
Total PHP MySQL Other RAM
Time (ms) % Time (ms) % File count Time (ms) % Query count Time (ms) % Amount %
Setup 3.9 5% 2.4 3% 72 1.7 2% 2 0.0 0% 569k 51%
Control 12.2 18% 1.3 2% 5 11.1 17% 12 0.0 0% 178k 16%
View 1.5 2% 1.5 2% 12 0.0 0% 0 0.0 0% 96k 8%
Theme 42.4 65% 3.6 5% 15 38.9 59% 3 0.0 0% 262k 23%
Stats 5.1 7% 0.1 0% 0 5.0 7% 1 0.0 0% 0k 0%
Total 65.1 100% 9.0 13% 104 56.7 87% 18 0.0 0% 1107k 100%