- Maintaining a List of Pages: The operating system keeps track of all pages currently residing in the memory. This list essentially serves as a queue, with the oldest pages at the front (head) of the queue and the newest at the back (tail).
- Bringing in a New Page: When a new page needs to be loaded into memory from the secondary storage (such as the hard disk), the operating system checks if there is space available in the physical memory. If there is available space, the new page is loaded into memory. However, if the memory is already full, a page replacement decision needs to be made.
- Handling Page Fault: In case of a page fault (when the requested page is not found in memory), the operating system selects a page to evict from the memory to make room for the incoming page. In FIFO, the decision is straightforward: the oldest page in memory, which is at the head of the list, is selected for replacement.
- Removing the Oldest Page: The page at the head of the list, which is the oldest page in memory, is removed to make space for the new page. This removal is performed regardless of the importance or frequency of use of the evicted page.
- Adding the New Page: Once the oldest page is removed, the new page is added to the memory and placed at the tail of the list, signifying it as the newest addition to the memory.
- The FIFO algorithm operates on a simple principle: the page that has been in memory the longest is the first to be replaced when a new page needs to be brought in.