The Gateway to Computer Science Excellence
+14 votes
1.5k 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): $1, 2, 1, 3, 7, 4, 5, 6, 3, 1$

Least Recently Used (LRU) page replacement policy is a practical approximation to optimal page replacement. For the above reference string, how many more page faults occur with LRU than with the optimal page replacement policy?

  1. $0$
  2. $1$
  3. $2$
  4. $3$
in Operating System by Veteran (105k points)
edited by | 1.5k views
+1
In full length test it is showing option b as a correct answer. So, please correct it.

3 Answers

+16 votes
Best answer

Using $LRU = 9$ Page Fault

Using Optimal$ = 7$ Page Fault

So, LRU-OPTIMAL $=2$

Option (C).

by Boss (38.4k points)
edited by
+3
option C).
+12 votes
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, page faults occur

LRU replacement policy

9 page faults occur page fault occurs for pages 1 2 3 7 4 5 6 3 1

So 2 more page faults than optimal algorithm

So the answer is $(C)$
by Boss (31.2k points)
edited by
0 votes

Solution to the above problem.

Tip: In question asking no. of page fault always calculate no. of  page hit as its count will be less so keeping a track on its count will be easy.

No. of Page fault =Total length of reference string - No. of Page Hit

by (151 points)

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
50,644 questions
56,523 answers
195,607 comments
101,286 users