Assignment 8, CPS801
Due date: During the Lab of March 19th
1-Redesign the page table of the
computer with 64-bit virtual address and 4 KB pages (question 2 of assignment 7) by using inverted page
table and explain
advantages and disadvantages of this design. For each memory request
describe how inverted page table is searching. Assume the computer has
256
MB
physical memory.(1
mark)
2-A computer has four page frames. The time of
loading
,time of last access, and the R and M bits for each page are as shown
below(The
times are in clock ticks):
Page |
Loaded |
Last ref |
R |
M |
0 |
126 |
279 |
0 |
0 |
1 |
230 |
260 |
1 |
0 |
2 |
120 |
272 |
1 |
1 |
3 |
160 |
280 |
1 |
1 |
A)Which page will NRU replace?
B)Which page will FIFO replace?
C)Which page will LRU replace?
D)Which page will second chance replace?
(1 mark)
3- Run
program
Example 9.3
with offset 30 command line value and
record the output and briefly explain the function of the
program.
(0.5 mark)
4- (Programming question) Write a program (use Unix compatible environment) that simulates a paging system. At the start of program, the user should be asked to choose a page replacement algorithm, choosing from LRU and FIFIO. On each cycle, read the number of referenced page from a file by using appropriate file system calls. Generate a listing similar to following figure, except rotated 90 degrees so that each new page reference increases the length of output file by one line.
Hint: Ignore distance string for
now but at the end
compare the two page replacement algorithms by reporting the page
faults for each of
the FIFO and LRU. Your input file contains the page references (for
example 0,2,1,3
and etc.) and by using proper data structure (for example array, stack,
queue or etc.) generate the resulting output similar to the
following: (2.5 marks)
For example for LRU the output is:
0: 0
2: 2 0
1: 1 2 0
3: 3 1 2 0
5: 5 3 1 2 | 0
4: 4 5 3 1 | 2 0
............
Submission: