Consider the virtual page reference string
1, 2, 3, 2, 4, 1, 3, 2, 4, 1
On a demand paged virtual memory system running on a computer system that main memory size of 3 pages frames which are initially empty. Let LRU, FIFO and OPTIMAL denote the number of page faults under the corresponding page replacements policy. Then
(A) OPTIMAL < LRU < FIFO
(B) OPTIMAL < FIFO < LRU
(C) OPTIMAL = LRU
(D) OPTIMAL = FIFO
Answer: (B)
Explanation:
First In First Out (FIFO)
This is the simplest page replacement algorithm. In this algorithm, operating system keeps track of all pages in the memory in a queue; oldest page is in the front of the queue. When a page needs to be replaced page in the front of the queue is selected for removal.
Optimal Page replacement:
in this algorithm, pages are replaced which are not used for the longest duration of time in the future. Least Recently Used (LRU) In this algorithm page will be replaced which is least recently used.
Solution:
the virtual page reference string is 1, 2, 3, 2, 4, 1, 3, 2, 4, 1 size of main memory pages frames is 3.
For FIFO: total no of page faults are 6 (depicted in red)

For optimal: total no of page faults are 5 (depicted in red)

For LRU: total no of page faults are 9 (depicted in red)

The Optimal will be 5, FIFO 6 and LRU 9. so, OPTIMAL < FIFO < LRU option (B) is correct answer. See http://www.geeksforgeeks.org/operating-systems-set-5/
This solution is contributed by Nitika Bansal
Quiz of this Question
Recommended Posts:
- GATE | GATE CS 2012 | Question 1
- GATE | GATE CS 2012 | Question 2
- GATE | GATE CS 2012 | Question 3
- GATE | GATE CS 2012 | Question 4
- GATE | GATE CS 2012 | Question 5
- GATE | GATE CS 2012 | Question 65
- GATE | GATE CS 2012 | Question 7
- GATE | GATE CS 2012 | Question 8
- GATE | GATE CS 2012 | Question 9
- GATE | GATE CS 2012 | Question 10
- GATE | GATE CS 2012 | Question 11
- GATE | GATE CS 2012 | Question 12
- GATE | GATE CS 2012 | Question 65
- GATE | GATE CS 2012 | Question 14
- GATE | GATE CS 2012 | Question 15
- GATE | GATE CS 2012 | Question 16
- GATE | GATE CS 2012 | Question 17
- GATE | GATE CS 2012 | Question 18
- GATE | GATE CS 2012 | Question 19
- GATE | GATE CS 2012 | Question 65

