Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions