You are on page 1of 2

Lab Activity: Page Replacement Algorithms

Objective:

● To understand the FIFO, LFU, and LRU page replacement algorithms.


● To implement the FIFO, LFU, and LRU page replacement algorithms in C++.
● To compare and contrast the performance of the three algorithms using three different
scenarios.

Materials:

● Computer with C++ compiler


● Text editor

Procedure:

Part 1: Understanding Page Replacement Algorithms

1. Read and understand the following resources about page replacement algorithms:
○ FIFO (First-In, First-Out) Page Replacement Algorithm:
https://www.geeksforgeeks.org/program-page-replacement-algorithms-set-2-fifo/
○ LFU (Least Frequently Used) Page Replacement Algorithm:
https://www.tutorialspoint.com/operating_system/os_memory_allocation_qa3.htm
○ LRU (Least Recently Used) Page Replacement Algorithm:
https://www.geeksforgeeks.org/videos/least-recently-used-lru-page-replacement-algo
rithm-in-os/
2. Summarize the main idea and key concepts of each algorithm in a concise and clear
manner.

Part 2: Implementing Page Replacement Algorithms

1. Create a C++ program to implement the FIFO, LFU, and LRU page replacement
algorithms.
2. For each algorithm, include functions to:
○ Initialize the page frames.
○ Handle page faults.
○ Replace a page when a new page is requested and no free frames are available.
○ Output the page frames after each page request.

Part 3: Comparing and Contrasting Algorithms

1. Define three scenarios with different page reference strings.


2. Run each algorithm on the three scenarios and record the number of page faults for each
algorithm.
3. Analyze the results and compare the performance of the three algorithms.
4. Discuss the strengths and weaknesses of each algorithm in the context of the different
scenarios.

Conclusion:

● Summarize the key findings of the lab activity.


● Reflect on the importance of page replacement algorithms in memory management.
● Discuss potential applications of page replacement algorithms in real-world systems.

You might also like