Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

implement a virtual memory simulator. This simulator consists of several important parts: the CPU which contains the memory management unit and the TLB cache, the

implement a virtual memory simulator. This simulator consists of several important parts: the CPU which contains the memory management unit and the TLB cache, the virtual page table, physical memory, and the operating system. This system must be modular, that is, the aforementioned parts must be represented by at least one class or module each. You are allowed to use Java or C++ to implement this simulator.

You must use fixed-size arrays to simulate the page table, the TLB, the page, and physical memory. Physical memory will be a two-dimensional array to simulate the page-frame # and the page of byte-addressable, byte-sized data. For instance, if physical memory can hold 16 pages of data and each page is 1kB, then you would have a 2d array like: ram[16][1024]. Read further to see determine what values you must use in your simulator. In each byte of ram you will store an integer value (yes, an int is typically larger than a byte but this will make the project simpler), The page table will be an array of PageTableEntries (so the page table will be a one-dimensional array. You will use the virtual page number (V-Page#) as the index to the elements of this array. Table entry for the virtual page table: V R D PageFrame# The TLB will be a one-dimensional array if TlbEntries. A TlbEntry consists of a virtual page number and a frame number, The TLB is small and must be scanned on every lookup. The arrays used to implement the page table and TLB will be arrays of data structures that represent the tables entries. Table entry for the TLB: V-Page# V R D PageFrame# Data Files: Included with the project specification is a file titled, project2_test_and_page_files.zip. This zip file contains the test files and page files that will simulate the various reads and writes to addresses by a running process (test files), and the process pages of data that the OS must load from the hard drive and put into memory. If a write to memory occurs and the OS needs to evict the dirty page, then the OS must write the page back to the file on the hard disk.

The test file format is:

0

1C85

1

A1B5

8517174

...

Where the first value represents whether it is a read (0) or write (1), The second value is the address to be read from or written to. If the action is a write (1) then there will be a third value which represents the integer to be written to memory. The page files hold the data element from the processes virtual memory. The Simulated Computer: The CPU address width is 16 bits The physical memory address width is 12 bits The page offset is 8 bits. The TLB contains 16 entries. The OS uses the clock algorithm for page replacement The MMU uses FIFO for replacement algorithm The OS resets r-bits every 10 instructions. Note: you are not permitted to use any containers or data structures provided by your chosen language other than simple arrays (i.e., no arraylists). You must implement the clock replacement algorithms data structure as a circular linked list. This should be done in the OS (kernel).

Execution: Your program will accept as a command line argument the test file path to a text file populated with virtual memory addresses (in hex and also provided with this project) that are used to simulate memory accesses called by a process. Your CPU will read them, hand them to the MMU for fetching or writing. If the address is preceded by a zero, then the MMU should only read value. If the address is preceded by a one, then the address will be followed by an integer value that needs to be written to physical memory. In the latter case, the page containing the data must have its dirty bit set by the MMU in both the TLB and the page table. This page must be written back to disk if your page replacement algorithm decides to replace the file. For each test file that you run, you should use an original copy of the page files that are available with the project. You do not want altered page files of a previous runs to be used. Keep the originals in a safe place and overwrite the working set for each simulation. This should be done programmatically from within your simulator, not manually. You should use a file copy facility of your chosen language, not an operating system call. You cannot assume that the operating system of the grader is the same as yours. The page files hold the simulated data of the process virtual memory. Each file is entitled with the page number that it represents. Output: Your program will output the following information in a CSV file (with appropriate headers): The address, Read or write (0 or 1), The value read or written, Soft miss (0 = false, 1 = true), Hard miss (0 = false, 1 = true), A hit (0 = false, 1 = true), page number of the evicted page, was that pages dirty bit set. The header of the CSV should be: Address, r/w, value, soft, hard, hit, evicted_pg#, dirty_evicted_page There should be one csv for every test file.

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

Guide To Client Server Databases

Authors: Joe Salemi

2nd Edition

1562763105, 978-1562763107

More Books

Students also viewed these Databases questions

Question

4. Describe the factors that influence self-disclosure

Answered: 1 week ago

Question

1. Explain key aspects of interpersonal relationships

Answered: 1 week ago