36.3k views
4 votes
Consider the following page reference string:

1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6

How many page faults would occur for the following replacement algorithms, assuming one, two, three, four, five, six, or seven frames? Remember all frames are initially empty, so your first unique pages will all cost one fault each.

a. LRU replacement
b. FIFO replacement
c. Optimal replacement

1 Answer

3 votes

Answer:

Number of frames LRU FIFO Optimal

1 20 20 20

2 18 18 15

3 15 16 11

4 10 14 8

5 8 10 7

6 7 10 7

7 7 7 7

Step-by-step explanation:

LRU: In Least Recently Used page replacement policy, the page that is used least recently will be replaced first.

FIFO: In this algorithm, the operating system keeps track of all the pages in memory in a queue, the oldest page is in the front of the queue and when a page needs to be replaced page in the front of the queue is selected for removal.

Optimal: In this algorithm, OS replaces the page that will not be used for the longest period of time in future

User Owner
by
5.4k points