Jawahar Education Society’s
A. C. Patil College of Engineering, Kharghar
                                                       Navi Mumbai 410210
 Student Name: Rahul Patil
                                                  PRN No.: 231111056
 Course Name: C.S.E. (IoT CS BC
                                                  Course code:CSL403
 ) Year: S.E.
                                                  Semester: IV
 Roll No.: 36
                        Experiment Evaluation Sheet
                               Experiment No:
                            Experiment Name:
           Implement First In First Out (FIFO) replacement Algorithm
Sr No. Evaluation Criteria           Marks      Performance      Correction
                                     (Out of 9) Date             Date and
                                                                 Signature of
                                                                 Instructor
  1     Experiment Performance
  2       Journal Performance
  3              Punctuality
                Total
A. C. Patil College of Engineering                                                                             OS Lab
Aim : Implement First In First Out (FIFO) replacement Algorithm
 Theory :
 FIFO Page Replacement Algorithm – Theory
 The First-In First-Out (FIFO) page replacement algorithm is one of the simplest page replacement techniques used in operating
 systems for memory management. In FIFO, the oldest page in memory (the one that entered first) is replaced when a new page
 needs to be loaded, and all frames are full.
 This algorithm uses a queue to keep track of the order of pages loaded into memory. When a page fault occurs (i.e., the
 requested page is not in any frame), the page at the front of the queue is removed, and the new page is added to the rear.
 Although FIFO is simple to implement, it does not consider page usage frequency, which may lead to suboptimal performance
 in some cases.
 Program:-
 #include<stdio.h>
 int main()
 {
 int i,j,n,a[50],frame[10],no,k,avail,count=0;
             printf("\n ENTER THE NUMBER OF PAGES:\n");
 scanf("%d",&n);
             printf("\n ENTER THE PAGE NUMBER :\n");
             for(i=1;i<=n;i++)
             scanf("%d",&a[i]);
             printf("\n ENTER THE NUMBER OF FRAMES :");
             scanf("%d",&no);
 for(i=0;i<no;i++)
             frame[i]= -1;
                         j=0;
                         printf("\tref string\t page frames\n");
 for(i=1;i<=n;i++)
                         {
                                     printf("%d\t\t",a[i]);
                                     avail=0;
                                     for(k=0;k<no;k++)
 if(frame[k]==a[i])
                                                 avail=1;
                                     if (avail==0)
                                     {
                                                 frame[j]=a[i];
                                                 j=(j+1)%no;
                                                 count++;
                                                 for(k=0;k<no;k++)
                                                 printf("%d\t",frame[k]);
 }
                                     printf("\n");
 }
                         printf("Page Fault Is %d",count);
                         return 0;
 }
A. C. Patil College of Engineering   OS Lab
 Output:-