Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This lab project addresses the implementation of page - replacement algorithms in a demand - paging system. Each process in a demand - paging system
This lab project addresses the implementation of pagereplacement algorithms in a demandpaging system.
Each process in a demandpaging system has a page table that contains a list of entries. For each logical page of the process, there is an entry in the table that indicates if the page is in memory. If the page is in memory, the memory frame number that page is resident in is indicated. Also, for each page, the time at which the page has arrived in memory, the time at which it has been last referenced, and the number of times the page has been referenced since the page arrived in memory are maintained.
The page table data structure is a simple array of pagetable entries PTEs Each PTE contains five fields as defined below:
struct PTE
int isvalid;
int framenumber;
int arrivaltimestamp;
int lastaccesstimestamp;
int referencecount;
Each process in the system has a page table that is simply an array of PTEs. Each process also has a pool of frames that is allocated. The frame pool for a process is represented as an array of integers, where each Integer represents the frame number of a frame that is free and is available for use by the process. Note that in order to get the frame number in the pool, you first need to access the integer in the array.
This lab project aims to exercise the various policies for page replacement. In particular, we study the following three pagereplacement policies:
FirstInFirstOut FIFO
LeastRecentlyUsed LRU
LeastFrequentlyUsed LFU
int processpageaccessfifostruct PTE pagetableTABLEMAXint tablecnt int pagenumber, int framepoolPOOLMAXint framecnt int currenttimestamp;
int countpagefaultsfifostruct PTE pagetableTABLEMAXint tablecnt int refrencestringREFERENCEMAXint referencecntint framepoolPOOLMAXint framecnt;
int processpageaccesslrustruct PTE pagetableTABLEMAXint tablecnt int pagenumber, int framepoolPOOLMAXint framecnt int currenttimestamp;
int countpagefaultslrustruct PTE pagetableTABLEMAXint tablecnt int refrencestringREFERENCEMAXint referencecntint framepoolPOOLMAXint framecnt;
int processpageaccesslfustruct PTE pagetableTABLEMAXint tablecnt int pagenumber, int framepoolPOOLMAXint framecnt int currenttimestamp;
int countpagefaultslfustruct PTE pagetableTABLEMAXint tablecnt int refrencestringREFERENCEMAXint referencecntint framepoolPOOLMAXint framecnt;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started