The document contains source code for implementing the FIFO page replacement algorithm. It takes the number of frames as input, then the reference string. It prints the reference string and frame numbers. For each reference, it checks if the page is in the frame list. If not, it's a page fault and the page is added to the frame list. If the list is full, the first page is replaced using FIFO. It prints the fault or hit and updates the frame list. Finally, it calculates and prints the total requests, faults and miss ratio.
The document contains source code for implementing the FIFO page replacement algorithm. It takes the number of frames as input, then the reference string. It prints the reference string and frame numbers. For each reference, it checks if the page is in the frame list. If not, it's a page fault and the page is added to the frame list. If the list is full, the first page is replaced using FIFO. It prints the fault or hit and updates the frame list. Finally, it calculates and prints the total requests, faults and miss ratio.
The document contains source code for implementing the FIFO page replacement algorithm. It takes the number of frames as input, then the reference string. It prints the reference string and frame numbers. For each reference, it checks if the page is in the frame list. If not, it's a page fault and the page is added to the frame list. If the list is full, the first page is replaced using FIFO. It prints the fault or hit and updates the frame list. Finally, it calculates and prints the total requests, faults and miss ratio.
ENROLLMENT NO.- 35196302718 NAME- ANANYA MAMGAIN ENROLLMENT NO.- 35196302718 NAME- ANANYA MAMGAIN ENROLLMENT NO.- 35196302718 NAME- ANANYA MAMGAIN Aim: Write a program to implement FIFO Page Replacement Algorithm. SOURCE CODE: print("Enter the number of frames: ",end="") capacity = int(input()) f,fault,top,pf = [],0,0,'Hit' print("Enter the reference string: ",end="") s = list(map(int,input().strip().split())) print("\nString|Frame →\t",end='') for i in range(capacity): print(i,end=' ') print("Fault\n ↓\n") for i in s: if i not in f: if len(f)<capacity: f.append(i) else: f[top] = i top = (top+1)%capacity fault += 1 pf = 'Miss' else: pf = 'Hit' print(" %d\t\t"%i,end='') for x in f: print(x,end=' ') for x in range(capacity-len(f)): print(' ',end=' ')