FIFO Page Replacement Algorithm C Program


C Program For FIFO Page Replacement Algorithm

Let us learn how to implement FIFO Page Replacement Algorithm in C programming language. This code for First In First Out Page Replacement makes use of arrays.

What is FIFO Page Replacement Algorithm?

When a page fault occurs, the OS has to remove a page from the memory so that it can fit in another page in the memory.


These page replacement algorithms are used in operating systems that support virtual memory management.

FIFO Page Replacement technique is one of the simplest one to implement amongst other page replacement algorithms. It is a conservative algorithm.

It is a low-overhead algorithm that maintains a queue to keep a track of all the pages in a memory.

When a page needs to be replaced, the page at the FRONT of the Queue will be replaced. The FIFO page replacement technique is not implemented in operating systems nowadays.

C Program To Implement FIFO Page Replacement Algorithm in OS



C Program To Implement FIFO Page Replacement Algorithm in OS

If you have any doubts or compilation errors in this C program to implement First In First Out Page Replacement Algorithm in operating system, let us know about it in the comment section below.

Recommended Programs
C Program For Optimal Page Replacement Algorithm
C Program For LFU Page Replacement Algorithm
C Program For LRU Page Replacement Algorithm
C Program To ImplementMulti-Level Feedback Queue Scheduling Algorithm
C Program For Round Robin Scheduling Algorithm
C Program To Implement Kruskal’s Algorithm
C Program To Generate Prime Numbers using Sieve of Eratosthenes Algorithm
C Program To Implement Caesar Cipher Algorithm
C Program For Hexadecimal To Binary Conversion
C Program To Find Factorial of a Number using Recursion

16 thoughts on “FIFO Page Replacement Algorithm C Program

    1. Tushar Soni Post author

      If on any consecutive request sequence containing n or fewer distinct page references, the conservative algorithm will incur n or fewer page faults.

  1. Mayank Mishra

    Amazing code. Finally I got a working code for fifo replacement. Thanks.

  2. Parag Vidhate

    The FIFO Page Replacement Algorithm is used by the VMX/VAX Operating Systems, along with some modifications.

  3. Sam

    Showing this errors:

    FIFO.c: In function ‘main’:
    FIFO.c:12: error: ‘i’ undeclared (first use in this function)
    FIFO.c:12: error: (Each undeclared identifier is reported only once
    FIFO.c:12: error: for each function it appears in.)
    I have declared “i” as an int , but shows funny results. Please fix it!!

  4. Sam

    I am trying to get Page Fault Percentage.
    I have added the below code but it shows 0 !! Can you help

    double fault_Per = page_faults/pages;

    printf(“\nPage Fault Percentage:\t%f\n”,fault_Per);


Let's Discuss