FOR FREE CONTENT

NET Question: FIFO page replacement algorithm

 

Page references A   B  A   C   A   B   D  B   A   C   D. Two frames are there. Find page faults using FIFO and LRU, page replacement algorithm page faults are.

 

(a) 9 and 7   

(b) 7 and 6     

(c) 9 and 8      

(d) 8 and 6   

 

Solution:

They are asking page fault for FIFO and LRU.

 

You should know:

Least Recently Used (LRU) algorithm, GATE question on LRU, FIFO page replacement algorithm, GATE on FIFO page replacement algorithm

 

First we calculate page faults for FIFO:

Page References: A   B  A   C   A  B   D   B  A   C   D. Number of frames in main memory is 2.

 

So, the number of page faults = 9.

 

Shortcut method:

But in examination it is not possible to solve it by this elaborative way we can do it by a single frame like below:

Page references: A  B   A   C  A   B   D  B   A   C   D and 2 frames.

 

 

Number of page faults= 9.

 

Now we calculate page fault using LRU policy:

Before seeing the solution please follow previous chapters: 

Least Recently Used (LRU) algorithm, GATE question on LRU

 

Page References: A   B  A   C   A  B   D   B  A   C   D and 2 frames.

 

 

So, the number of page faults = 8.

 

Shortcut method:

But in examination it is not possible to solve it by this elaborative way we can do it by a single frame like below:

Page references: A  B   A   C  A   B   D  B   A   C   D and 2 frames.

 

 

Number of page faults= 8.

 

Final answer:

Number of page faults using FIFO policy = 9

Number of page faults using LRU policy =   8

 

So, option (C) is correct