0% found this document useful (0 votes)
11 views3 pages

PH M Minh Hào

The document analyzes page replacement algorithms using a reference string with 4 frames. It details the page fault counts for LRU (10 faults), FIFO (12 faults), and Optimal (9 faults) algorithms. Each algorithm's logic and step-by-step execution are provided to illustrate how page faults occur.

Uploaded by

combodo2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

PH M Minh Hào

The document analyzes page replacement algorithms using a reference string with 4 frames. It details the page fault counts for LRU (10 faults), FIFO (12 faults), and Optimal (9 faults) algorithms. Each algorithm's logic and step-by-step execution are provided to illustrate how page faults occur.

Uploaded by

combodo2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Page Replacement Algorithms –

Page Fault Analysis


Reference String:
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1

Number of Frames: 4

a) LRU (Least Recently Used)


Logic: Always replace the page that was least recently used in the past.

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

Total Page Faults (LRU): 10


b) FIFO (First-In, First-Out)
Logic: Replace the page that entered memory first (oldest page).

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

Total Page Faults (FIFO): 12

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

Total Page Faults (Optimal): 9

Summary
Algorithm Page Faults
LRU 10
FIFO 12
Optimal 9

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy