6.3.3 Page Replacement Algorithms
6.3.3 Page Replacement Algorithms
(Difficulty Note: This is an internal OS optimization, very detailed for 7th grade. Focus on the necessity.)
When the OS uses virtual memory, it often has to decide which page (a small block of a program) to move out of the fast RAM and onto the slow hard drive to make space for a new page. The way the OS makes this decision is using page replacement algorithms.
Imagine your desk (RAM) is full of books, and you need to bring a new book (page) onto the desk. You have to decide which existing book to put back on the shelf (hard drive) to make room. The OS uses different strategies for this, such as:
- FIFO (First-In, First-Out): Evict the page that has been in memory the longest. (Like putting away the first book you picked up.)
- LRU (Least Recently Used): Evict the page that hasn't been used for the longest time. (Like putting away the book you haven't touched in a while.)
- Optimal: (This one is theoretical) Evict the page that won't be used for the longest time in the future. The OS can't actually know the future, but this is a goal to aim for.
These algorithms help the OS make smart choices to keep the programs you're using most often in the fast RAM, so your computer runs as quickly as possible.
Bibliography:
- Page Replacement Algorithms in Operating System. (2025, March 21). GeeksforGeeks. Retrieved July 10, 2025, from https://www.geeksforgeeks.org/operating-systems/page-replacement-algorithms-in-operating-systems/
- Optimal Page Replacement Algorithm. (n.d.). TutorialsPoint. Retrieved July 10, 2025, from https://www.tutorialspoint.com/operating_system/optimal_page_replacement_algorithm.htm