Question: Write a C program (well-structured modular) to compute the number of page faults for the FIFO page replacement scheme, given a reference string. The program

Write a C program (well-structured modular) to compute the number of page faults for the FIFO page replacement scheme, given a reference string.

The program can be structured as follows: the program will first interactively prompt and read the length of the reference string and then reference string itself. Then it will prompt and read the range for the number of page frames. For each value in the range then simulate the execution of the page replacement algorithm on the reference string, compute the number of page faults and print it out.

Assume that the length of the reference string is at most 20 so that the reference string can be stored in an array of int type. Assume that the number of frames available will be at most 20, so you can implement the data structure (queue) needed for the simulation of the algorithm using arrays rather than using pointers, if you prefer it that way. Also assume that all frames are initially empty, so your first unique pages will all cost one fault each.

Here is a sample run of the program:

Welcome to FIFO Page Replacement Simulation Program!!

Enter the length of the reference string: 12

Enter the reference string: 1 2 3 4 1 2 5 1 2 3 4 5

Enter the range for number of frames: 1 6

Page fault for 1 frame(s): 12

Page fault for 2 frame(s): 12

Page fault for 3 frame(s): 9

Page fault for 4 frame(s): 10

Page fault for 5 frame(s): 5

Page fault for 6 frame(s): 5

Program terminated

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!