Skip to main content

GATE CSE 2017Operating System › Memory Management & Virtual MemoryVerified

GATE CSE 2017 PYQ: Recall that Belady's anomaly is that the page-fault rate may increase as the number of allocated frames…

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:

  • S1S_1: Random page replacement algorithm (where a page chosen at random is replaced) suffers from Belady's anomaly.
  • S2S_2: LRU page replacement algorithm suffers from Belady's anomaly.

Which of the following is CORRECT?

  1. A
    S1S_1 is true, S2S_2 is true
  2. B
    S1S_1 is true, S2S_2 is false
    Correct answer
  3. C
    S1S_1 is false, S2S_2 is true
  4. D
    S1S_1 is false, S2S_2 is false

Answer

(B) S 1 S_1 S 1 ​ is true, S 2 S_2 S 2 ​ is false

Approach

Belady's anomaly occurs only for page replacement algorithms that are NOT stack algorithms. A stack algorithm obeys the inclusion property: the set of pages held in a memory of size k frames is always a subset of the set held in k+1 frames for the same reference string. LRU is a stack algorithm, so it can never suffer the anomaly. The random replacement algorithm has no such ordering guarantee, so it can (in some access sequences) exhibit the anomaly. Hence S1 is true and S2 is false.

The key distinguishing property is the stack/inclusion property. LRU obeys it and is therefore immune to Belady's anomaly (S2 false). The random replacement algorithm does not obey it and can exhibit the anomaly (S1 true). Hence option B is correct.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.