Lab VIII: Memory Management - Page Replacement
Date: 3 October 2019
In this lab, you will be extending the process simulator and
memory manager written in the last lab. We will now handle the case
where the total number of pages required for the processes exceeds
the number of frames in physical memory. You will need to write
a function that takes the PID of the process making a page request,
and other data structures required for the different page replacement
algorithms and returns the frame number in which the new page
shall be loaded.
Write the following function:
- Page Replacement Algorithm:
int page_fifo_global (int first_frame)
- Increment the first_frame by 1 and then return it.
- int page_fifo_local (int first_frame[], int pid)
first_frame is an array storing the indices of the first frame
(i.e., the oldest frame) in physical memory for every process.
It stores the oldest frame of process whose pid=i at first_frame[i].
It then updates the first_frame[i] to the oldest frame
held by the process and returns it.