Question
Recall that Belady's anomaly is that the page-fault rate may increase as the number of allocated frames increases. Now, consider the following statements:
S1: Random page replacement algorithm (where a page chosen at random is replaced) suffers from Belady's anomaly
S2: LRU page replacement algorithm suffers from Belady's anomaly
Which of the following is CORRECT?
Official answer and solution
- Official answer
- B
- From
- Official GATE 2017 answer key
Solution
Classify the page replacement algorithms into stack and non-stack algorithms to determine susceptibility to Belady's anomaly.
Belady's anomaly occurs when increasing the number of page frames allocated to a process results in an increase in the number of page faults.
A page replacement algorithm is called a stack algorithm if the set of pages that would be in memory with frames is always a subset of the pages that would be in memory with frames at any point in time: .
It is mathematically proven that stack algorithms never suffer from Belady's anomaly. Both LRU (Least Recently Used) and Optimal (OPT) are stack algorithms. Therefore, LRU never suffers from Belady's anomaly, making statement S2 false.
In contrast, non-stack algorithms like FIFO (First-In, First-Out) and Random replacement do not maintain the inclusion property. The Random page replacement algorithm can replace a page that is needed immediately afterward, and increasing the number of frames can lead to a higher expected or actual number of page faults for specific reference strings. Hence, statement S1 is true.
Thus, S1 is true and S2 is false.
B
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2017 Computer Science and Information Technology (CS) Session 1
- Question
- 40 of 65, printed as CS Q.40
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.