Jump to content

6.3.3 Page Replacement Algorithms

From Computer Science Knowledge Base
Revision as of 12:22, 11 July 2025 by Mr. Goldstein (talk | contribs) (Created page with "==== 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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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: