Assignment 7, due Mar. 9
Part of
the homework for CS:3620, Spring 2018
|
On all assignments, your name must be legible as it appears on your University ID card! Assignments are due at the start of class on the day indicated (usually Friday). Exceptions will be by advance arrangement unless there is what lawyers call "an act of God" (something outside your control). Homework must be turned in on paper, either in class or in the teaching assistant's mailbox. Never push late work under someone's door!
a) The behavior of getcommand() has changed. There is one change that a user can observe. (0.4 points)
b) The behavior of launch() has changed. There are two changes that a user can observe. (0.6 points)
_ _ _ _ _ _ _ _ _ |_|_|_|_|_|_|_|_|_| Virtual address |page | word | _ _ _ _ _ _ _ _ _ _ _ |_|_|_|_|_|_|_|_|_|_|_| Physical address | frame | word |
At one instant in time, the page table in the memory management unit contains the following (all information is shown in binary):
0 0 0: 1 0 1 0 0 0 0 0 1 0 0 1: 1 0 0 0 0 0 0 1 0 0 1 0: 1 1 0 0 0 1 0 0 1 0 1 1: 0 0 0 0 0 0 1 0 1 1 0 0: 0 0 0 0 1 1 0 0 0 1 0 1: 0 0 0 0 0 0 1 0 1 1 1 0: 0 0 0 0 0 1 0 0 1 1 1 1: 0 0 0 0 1 0 0 0 0 _ _ _ _ _ _ _ _ _ index:|_|_|_|_|_|_|_|_|_| Virtual address |r w x| | frame | rights
For each of the following virtual addresses, give the corresponding physical address, and state whether it is a legal memory address, and if legal, what access is permitted. (Illegal addresses permit no access.)
a)
0 1 0 1 0 1 0 1 0
b)
1 0 1 0 1 0 1 0 1
c)
0 0 1 1 0 0 1 1 0
d)
1 1 0 0 1 1 0 0 1
e)
0 0 0 1 1 1 0 0 0
char * f = mmap( NULL, sysconf( _SC_PAGESIZE )*16, PROT_READ, MAP_SHARED, open( "~/myfile", O_RDONLY ), 0 );
a) Write a for loop that prints the entire contents of ~/myfile assuming that it has been opened using the above code. (0.6 points)
b) How many page faults occur, at minimum, during the execution of the code you wrote for part a? (0.2 points)
c) Under what circumstances would more page faults occur than you suggested in part b. (0.2 points)