Question 1
Pick any process of your choice from the above. Assume a page size of 4096 bytes. The main memory is 16 KB. Use pure demand paging. In other words, when the process starts running, the physical main memory is empty (completely free). Read one line at a time from the process file and translate the logical address into its physical address. Write them into an output file where each line in the file contains
logical address, physical address, <page fault>
<page fault> is 0 if there is no page fault for that logical address reference and 1 if there is a page fault. When a page fault occurs, call a
page replacement algorithm. For this lab, implement only FIFO replacement, i.e. replace the first page brought into the memory.
Write an output on the screen every 1000 lines of the process showing the pages of the process in the main memory and the number of page faults until that time (from the beginning of the process).
Model the main memory as an array of frames and each frame entry contains the page number and the process ID. In our case, the PID is 0 because there is only one process.