Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions