Page Replacement

Suppose that a process needs to load a page from disk into memory but there are no free frames available.

The operating system will do either of the following to allow the page to load:

  1. A considerable part of memory is used to store I/O buffers (= arrays with I/O data.) Freeing some buffers, if they aren't currently needed, would free space for more frames.
  2. Put the process into a waiting state until other processes go into waiting or terminate so that enough frames become available.
  3. Swap some process out of memory completely, freeing up its page frames.
  4. Find some page in memory that isn't being used right now, and swap that page only out to disk (without swapping the entire process,) freeing up a frame that can be allocated to the process requesting it. This is known as page replacement and is the most commonly used solution. There are many different algorithms to implement it.