Question: In a C program, build a simulator that reads a memory trace and simulates the action of a virtual memory system with a single level

In a C program, build a simulator that reads a memory trace and simulates the action of a virtual memory system with a single level page table. Your simulator should keep track of what pages are loaded into memory. As it processes each memory event from the trace, it should check to see if the corresponding page is loaded. If not, it should choose a page to remove from memory. If the page to be replaced is dirty (that is, previous accesses to it included a Write access), it must be saved to disk. Finally, the new page is to be loaded into memory from disk, and the page table is updated. Assume that all pages and page frames are 4 KB (4096 bytes).

Of course, this is just a simulation of the page table, so you do not actually need to read and write data from disk. Just keep track of what pages are loaded. When a simulated disk read or write must occur, simply increment a counter to keep track of disk reads and writes, respectively.

Implement the following page replacement algorithms: LRU. FIFO. VMS' second chance page replacement policy. The traces are: gcc.trace swim.trace bzip.trace sixpack.trace Just looking for a general outline how this C program would be structured, don't need a complete 100% working code.

fscanf() is used to scan in one memory address.

The simulator (called memsim) should take the following arguments: memsim Use a separate functions for each algorithm, i.e.: your program must declare the following high level functions: lru(), fifo() and vms().

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!