Question: The output should be this: You are required to program First In First Out Page Replacement algorithm in C. You are provided with some pages

 The output should be this: You are required to program First

In First Out Page Replacement algorithm in C. You are provided with

some pages as an integer array, e.g., int pages [SIZE ]={1,2,3,4}; in

The output should be this:

the main method. You have to check if these pages are available

You are required to program First In First Out Page Replacement algorithm in C. You are provided with some pages as an integer array, e.g., int pages [SIZE ]={1,2,3,4}; in the main method. You have to check if these pages are available in the frames or not. You are provided int pageFrames [SIZE] ; at a global scope. In the main method, pageFrames is initialized by 1 to avoid any garbage values in it. In order to check if page fault occurs or not, a for loop is used to check for each page in the pageFrames. Finally, number of page faults are printed. Since, we are implementing First In First Out, we would implement a Queue that follows the same principle. You are also provided some supplementary functions that would help you implement Queue along with some global variable that you can use for this program. Please refer to the code provided to you for more details Task: Your task in this lab is to fill in the managePageFrames (int pageNumber), enqueue (int item), dequeue () along with isPageHit (int pageNumber) method. Implementation of isPageHit is very similar to what we did in the class except this time, it is taking only one parameter. You are most welcome to use the class code for this method with slight modification as per the requirement. In order to implement managePageFrames check if queue is full or not? If it is not full, insert that pagenumber into the queue. If queue is full, first remove the first element of the queue and then insert the new pagenumber. Make sure to display every time a page is removed from the queue (simply printf the pagenumber removed). In order to implement enqueue, insert the element at the end of the queue. Make sure to display every time a page is inserted into the queue (simply print f the pagenumber inserted). In order to implement dequeue check if queue is not already empty and then remove the element at the front of the queue. Check your program against the following pages in the main method: int pages [ SIZE ]={1,2,3,4};// case 1 int pages [SIZE]={1,1,2,3};// case 2 int pages [SIZE]={1,2,2,3};// case 3 int pages [SIZE]={1,1,1,1};// case 4 Below is the code provided to you: \#includeh> \#includeh> \#include> > \#define SIZE 4/umber of pages \#define QUEUE_SIZE 3//max. size of the queue int front =1;// points to the front of the queue 1 inserted into the queue 2 inserted into the queue 3 inserted into the queue 1 removed from the queue 4 inserted into the queue Total number of page faults: 4

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!