Demonstration and Analysis of Belady’s Anomaly
Demonstration and Analysis of Belady’s Anomaly
1. Aim
To demonstrate Belady’s Anomaly using FIFO page replacement by displaying the frame table with Hit/Miss status and comparing page faults for different frame sizes.
2. Objective
-
To simulate FIFO page replacement
-
To display frame contents after each reference
-
To calculate total page faults
-
To verify Belady’s anomaly
3. Theory
🔹 Belady’s Anomaly
Belady’s anomaly occurs when:
Increasing the number of frames results in an increase in page faults.
This happens in FIFO, but not in LRU or Optimal (stack algorithms).
4. Classic Reference String
This string shows anomaly for FIFO when frames increase from 3 to 4.
5. Algorithm
For each frame size:
-
Initialize frames as empty.
-
For each page reference:
-
If page exists → Hit
-
Else → Replace using FIFO → Miss
-
-
Display frame contents and status.
-
Count page faults.
-
Compare results.
C Program (With Frame Table and Hit/Miss)
Sample Input
Sample Output
FIFO with 3 Frames
Observation Table
| Frames | Hits | Misses |
|---|---|---|
| 3 | 3 | 9 |
| 4 | 2 | 10 |
Page faults increased when frames increased → Belady’s Anomaly observed.
6. Result
Belady’s Anomaly was successfully demonstrated using FIFO. The frame table clearly shows that increasing frames from 3 to 4 increased page faults.
Comments
Post a Comment