0% found this document useful (0 votes)
12 views1 page

Os Notes2

Uploaded by

Mohd Faizan Alam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views1 page

Os Notes2

Uploaded by

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

Class Notes: Operating System

Page replacement policies in operating systems are algorithms used to decide which memory pa

### **Key Concepts**


1. **Page Fault**: Occurs when a program tries to access a page that is not in physical memory,
2. **Frame**: A fixed-size block of physical memory where pages are loaded.
3. **Page**: A fixed-size block of virtual memory corresponding to a frame.

---

### **Common Page Replacement Policies**


#### 1. **First-In-First-Out (FIFO)**
- **Description**: The oldest page in memory (the one brought in first) is replaced when a new pa
- **Advantages**: Simple to implement.
- **Disadvantages**: Does not consider page usage; may replace frequently used pages (Belady

**Example**:
- Assume 3 frames and the reference string: `7, 0, 1, 2, 0, 3, 0, 4`.
- Process:
- Pages `7, 0, 1` are loaded into frames.
- Next, `2` causes a page fault and replaces `7` (oldest).
- Continue replacing the oldest pages as needed.
- Final Result: High page faults if the reference string frequently revisits older pages.

---

#### 2. **Optimal Page Replacement (OPT)**


- **Description**: Replaces the page that will not be used for the longest time in the future.
- **Advantages**: Produces the least number of page faults.
- **Disadvantages**: Not feasible in practice because future references are unknown.

**Example**:
- Reference string: `7, 0, 1, 2, 0, 3, 0, 4`, with 3 frames.
- Process:
- Pages `7, 0, 1` are loaded into frames.
- For page `2`, replace `7` since it is used the furthest in the future.
- For subsequent faults, always replace the page with the furthest future use.
- Result: Minimum possible page faults for the given reference string.

---

#### 3. **Least Recently Used (LRU)**


- **Description**: Replaces the page that has not been used for the longest time.
- **Advantages**: Good approximation of OPT; considers recent usage patterns.
- **Disadvantages**: Requires extra memory for tracking usage.

**Example**:
- Reference string: `7, 0, 1, 2, 0, 3, 0, 4`, with 3 frames.
- Process:
- Pages `7, 0, 1` are loaded.

You might also like