”
CS 3413留学生作业 辅导、 写作c/c++程序语言作业、 辅导c++实验作业、 写作program课程作业
CS 3413
Assignment 7
Due Date: November 18th, 2019 at 9:30 am
ASSIGNMENT IS TO BE COMPLETED INDIVIDUALLY BY ALL STUDENTS!
Your solution is to be written in C and submitted via D2L.
This question consists of writing a program that translates logical to physical addresses
for a virtual address space of size 232 bytes. Your program will read from stdin a list of
logical addresses with access type (r read or w write), translate each logical address to
a physical address and then print the physical address that would be accessed in memory.
However, your simulation can only have n pages loaded in memory at any given time! The
goal is to simulate the steps involved in translating logical to physical addresses.
Design your simulation with the following parameters:
A page is 212 = 4 kilobytes. (Note, this means a frame is also 212 in size).
Your process has been allocated n frames. n is a parameter to your program on the
command line.
For the address translation you are to use the multiple levels of page directory, page
table and offset for mapping (page directory is 10 bits, page table is 10 bits, page offset is
12 bits)
Your program should print for each logical address read:
logical address – physical address
At the end of simulation you will print the total number of page faults that occur and the
number of dirty pages that are paged out.
Notes:
Example for format of the input is:
r 12345678
w 87654321
Running your program with a sample file can be done as:
./a.out 10 sample_logical_addr
For this question you are to use the following page replacement policy:
1. If an empty frame is available you use it.
2. If clean frames exist, then you choose one based on the Least Recently Used
(LRU) page replacement policy.
3. If only dirty pages exist, then you choose one based on the Least Recently
Used page replacement policy.
Page directory Page table Page offset
2/1
You do NOT have to worry about saving pages that are written too! You just need
to keep track of whether the page is clean or dirty. Every time the page is paged-in,
it is clean. But as soon as you write to it, it is dirty.
Be aware of data type sizes and signed vs unsigned!
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。