+14 votes
1.7k 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
edited | 1.7k 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.9k 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 (7.3k 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.4k points)
Answer:

+13 votes
2 answers
1
+21 votes
3 answers
2
+35 votes
5 answers
3
+25 votes
4 answers
4
+27 votes
6 answers
5
+12 votes
1 answer
6
+15 votes
3 answers
7