The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+14 votes
1.6k views

A process has been allocated $3$ page frames. Assume that none of the pages of the process are available in the memory initially. The process makes the following sequence of page references (reference string): $\mathbf{1, 2, 1, 3, 7, 4, 5, 6, 3, 1}$

If optimal page replacement policy is used, how many page faults occur for the above reference string?

  1. $7$
  2. $8$
  3. $9$
  4. $10$
asked in Operating System by Veteran (59.5k points)
edited by | 1.6k views

4 Answers

+11 votes
Best answer

Optimal replacement policy

$1$     $1$     $1$     $1$     $1$

$2$      $7$      $4$     $5$     $6$

$3$      $3$      $3$     $3$     $3$

 For Pages $1 \ 2  \ 3  \ 6  \ 4  \ 5 \ \ 6$.... $7$ page fault occur, so answer is (A).

answered by Boss (31.4k points)
edited by
+1
for page 1 2 3 7 4 5 6
+2
Please write clearly. total 7 page faults and answer is A.
0
Kindly correct your typo mam... it should be 7 at place of 6 at 4th position
+4 votes
1 2 1 3 7 4 5 6 3 1

In optimal scheduling we schedule page in place of that page which is not used for scheduling in future .........

If initially memory is empty so 3 page faults

1,2 , (1) ,3 so initially 3 pages are there now - 3 faults

7 in place of (2) because 2 is not in future - 1 fault

4 in place of 7 - 1 fault

5 in place of 4 - 1 fault

6 in place of 5 - 1 fault

so total faults = 3+1+1+1+1 = 7

so option A
answered by Loyal (6.6k points)
0 votes

Initially, Page fault Count =0

     

After first 3 pages ,i.e 1,2,1 Page Fault count=2.

1 2  

After 4 pages i.e 1,2,1,3 Page Fault count =3.

1 2 3

After 5 pages i.e.1,2,1,3,7 ,we have to replace one page out 3 from above situation ,candidate for page replacement is 1,2,3 we choose page No.2 .reason=we use optimal page replacement ,so we see the future reference of page and came to conclusion that  page No=2  have No reference in future or if they have reference in future ,which is late bit as compare to page no.1 and 3 .

Page fault count=4

1 7 3

 After 6 pages i.e.1,2,1,3,7,4. we choose page 7 for replacement with same logic as above. Page Fault Count =5

1 4 3

After 7 pages i.e.1,2,1,3,7,4,5 we choose page 4 for replacement.Page Fault count=6

1 5 3

 After 8 pages i.e.1,2,1,3,7,4,5,6 .we choose page 5 for replacement.page fault count=7

1 6 3

After 10 pages i.e.1,2,1,3,7,4,5,6,3,3. page No=3 and page No=3 already present so no page fault hence page fault count=7.

Answer 7

answered by (29 points)
–1 vote
82. A)
answered by Active (1.3k points)
Answer:

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

38,112 questions
45,619 answers
132,311 comments
49,292 users