联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2019-11-09 11:26

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!


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp