$29
Assignment Overview
This assignment focuses on memory management within an operating system, and is the first milestone in a larger simulation. You will design and implement the C/C++ program which is described below.
It is worth 30 points (3% of course grade) and must be completed no later than 11:59 PM on Thursday, 4/1.
Assignment Deliverables
The deliverables for this assignment are the following files:
proj09.makefile – the makefile which produces proj09 proj09.student.cpp – the source code file for your solution
Be sure to use the specified file names and submit them for grading via the CSE Handin system before the project deadline.
Assignment Specifications
The program will simulate the steps to manage primary storage using paging without a TLB. The system to be simulated contains 65,536 bytes of RAM which is divided into 64 page frames. Virtual addresses are 14 bits in length.
1. The program will simulate the actions performed in the memory management unit by processing a file which contains zero or more memory references. Each line of the file will contain the following information:
a) operation ("RD" for "read" or "WR" for "write")
b) virtual address (four hexadecimal digits, with leading zeroes)
Items in the line will be separated by exactly one space, and each line will terminate with a newline. For example:
RD 0ad0
WR 0ac2
RD 3bd8
The first line represents an operation where the process is reading from virtual address 0ad0, and the second line represents an operation where the process is writing into virtual address 0ac2.
2. For each memory reference in the file, your program will display one line with the following information:
a) operation being performed (two characters; "RD" for read and "WR" for write)
b) virtual address being referenced (four hexadecimal digits, with leading zeroes)
c) page number (one hexadecimal digit)
d) page offset (three hexadecimal digits, with leading zeroes)
Items in the line will be separated by exactly one space, and the line will terminate with a newline. For example:
RD 0ad0 2 2d0
WR 0ac2 2 2c2
RD 3bd8 e 3d8
3. After the simulation is completed, your program will display the following counts (with appropriate labels):
a) total number of read operations
b) total number of write operations
4. After the simulation is completed, your program will display the contents of the page table. The display will contain one line for each page table entry:
a) index of the page table entry (one hexadecimal digit)
b) V bit (one character; '0' for not valid, '1' for valid)
c) W bit (one character; '0' for not writable, '1' for writable)
d) P bit (one character; '0' for not present, '1' for present)
e) R bit (one character; '0' for not referenced, '1' for referenced)
f) M bit (one character; '0' for not modified, '1' for modified)
g) frame number (two hexadecimal digits, with leading zeroes)
The page table display will include appropriate column headers. For example:
VWPRMFN
-----------------
[0]:1000000
[1]:1000000
.
.
[e]: 0 0 0 0 0 00
[f]: 1 1 0 0 0 00
5. Command line arguments will be used to specify the name of the file which contains the memory references to be processed (the "-refs" option), the name of the file which contains the process information (the "-proc" option), and to display debugging information (the "-debug" option).
a) The "-refs" option will be followed by the name of the file which contains zero or more references (as defined above).
b) The "-proc" option will be followed by the name of the file which contains zero or more lines with information about the set of valid pages in the virtual address space of the process. Each line of the file will contain the following information:
a) page number (one hexadecimal digit)
b) write permission (one hexadecimal digit; 0 for not writable, 1 for writable)
Items in the line will be separated by exactly one space, and the line will terminate with a newline. For example:
0 0
◦ 0 f 1
6. If the "-debug" option has been selected, your program will display:
a) the contents of the page table at the start of the simulation
b) the contents of the page table after each memory reference is processed
7. The program will include appropriate error-handling.
Assignment Notes
1. As stated above, your source code file will be named "proj09.student.cpp" and you must use "g++" to translate your source code file in the CSE Linux environment.
2. Valid executions of the program might appear as follows:
proj09 –proc proc1 -refs test1 -debug
proj09 –debug –refs fileA –proc fileB
proj09 –proc test3p –refs test3r
3. Your program may assume that the "-refs" and the "-proc" files are formatted correctly:
a) If the "-refs" file can be accessed, the contents will be valid as per #1 under "Assignment Specifications".
b) If the "-proc" file can be accessed, the contents will be valid as per #5 under "Assignment Specifications".
4. Your program must create a data structure representing the page table and set all of the entries to zero at the start of the simulation.
Your program will then use the "-proc" file to initialize the page table entries for the pages which are part of the virtual address space of the process.
For this assignment, your program will not update the page table. Therefore, all entries in the page table (except possibly the V bit and the W bit) should be zero in every page table display. In subsequent assignments, your program will actively manage the page table (and thus the page table display will change over time).