PH M Minh Hào
PH M Minh Hào
Number of Frames: 4
Step-by-step Summary:
- First 4 pages (7, 0, 1, 2) → All cause faults → 4 faults
- 0 → in memory → no fault
- 3 → not in memory → replace LRU (7) → +1 fault
- 0 → in memory → no fault
- 4 → not in memory → replace LRU (1) → +1 fault
- 2 → in memory → no fault
- 3 → in memory → no fault
- 0 → in memory → no fault
- 3 → in memory → no fault
- 0 → in memory → no fault
- 3 → in memory → no fault
- 2 → in memory → no fault
- 1 → not in memory → replace LRU (4) → +1 fault
- 2 → in memory → no fault
- 0 → in memory → no fault
- 1 → in memory → no fault
- 7 → not in memory → replace LRU (3) → +1 fault
- 0 → in memory → no fault
- 1 → in memory → no fault
Step-by-step Summary:
- First 4 pages (7, 0, 1, 2) → All cause faults → 4 faults
- 0 → in memory → no fault
- 3 → not in memory → replace 7 (oldest) → +1 fault
- 0 → in memory → no fault
- 4 → not in memory → replace 0 → +1 fault
- 2 → in memory → no fault
- 3 → in memory → no fault
- 0 → not in memory → replace 1 → +1 fault
- 3 → in memory → no fault
- 0 → in memory → no fault
- 3 → in memory → no fault
- 0 → in memory → no fault
- 3 → in memory → no fault
- 2 → in memory → no fault
- 1 → not in memory → replace 4 → +1 fault
- 2 → not in memory → replace 2 → +1 fault
- 0 → in memory → no fault
- 1 → in memory → no fault
- 7 → not in memory → replace 3 → +1 fault
- 0 → in memory → no fault
- 1 → in memory → no fault
c) Optimal Replacement
Logic: Replace the page that will not be used for the longest time in the
future.
Step-by-step Summary:
- First 4 pages (7, 0, 1, 2) → All cause faults → 4 faults
- 0 → in memory → no fault
- 3 → not in memory → replace 7 (used furthest or never) → +1 fault
- 0 → in memory → no fault
- 4 → not in memory → replace 1 (used far in future) → +1 fault
- 2 → in memory → no fault
- 3 → in memory → no fault
- 0 → in memory → no fault
- 3 → in memory → no fault
- 0 → in memory → no fault
- 3 → in memory → no fault
- 2 → in memory → no fault
- 1 → not in memory → replace 4 → +1 fault
- 2 → in memory → no fault
- 0 → in memory → no fault
- 1 → in memory → no fault
- 7 → not in memory → replace 3 (not used again) → +1 fault
- 0 → in memory → no fault
- 1 → in memory → no fault
Summary
Algorithm Page Faults
LRU 10
FIFO 12
Optimal 9