You are on page 1of 2

OPERSYS Homework #4: Virtual Memory

Special Term, SY 2014-2015

Virtual Memory Page Replacement Algorithms


Consider a system with three (3) physical memory frames that are initially empty and the page references (reference
string) given in the table 1 below. Each column in the first row indicates the reference number of every page reference
in the reference string. In the second row, those marked with M are modified pages. The third row of the table shows
the reference string (4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 4, 3, 2, 1, 0). Assume that when there are empty frames, FIRST FIT memory
allocation policy is applied
Table 1

1.

Using FIFO and OPT page replacement schemes:


th
th
th
th
a. Show the page contents of the three memory frames after the 4 , 7 , 11 , and 15 page references.
Indicate which pages were loaded in which frames.
b. Determine the number of page faults.
c. Given that the memory access time is 100 nanoseconds, swap-in time is 400 microseconds, swap-out time
is 400 microseconds, page fault overhead is 100 microsecond and restart overhead is 100 microsecond,
compute for EAT (effective access time) when using each of the Page replacement algorithms.
d. How much is the performance degradation (for each PRA)?
e. If the tolerable performance degradation in 15%, what should be the allowable (maximum) page fault rate
(for each PRA)?

2.

Using LRU and Second Chance page replacement schemes:


th
th
th
th
a. Show the page contents of the three memory frames after the 4 , 7 , 11 , and 15 page references.
Indicate which pages were loaded in which frames.
b. Determine the number of page faults.
c. Given that the memory access time is 100 nanoseconds, swap-in time is 400 microseconds, swap-out time
is 400 microseconds, page fault overhead is 100 microsecond and restart overhead is 100 microsecond,
compute for EAT (effective access time) when using each of the Page replacement algorithms.
d. How much is the performance degradation (for each PRA)?
e. If the tolerable performance degradation in 15%, what should be the allowable (maximum) page fault rate
(for each PRA)?

3.

Using Enhanced Second Chance and Counting-Based (Least Frequently Used) page replacement schemes:
th
th
th
th
a. Show the page contents of the three memory frames after the 4 , 7 , 11 , and 15 page references.
Indicate which pages were loaded in which frames.
b. Determine the number of page faults.
c. Given that the memory access time is 100 nanoseconds, swap-in time is 400 microseconds, swap-out time
is 400 microseconds, page fault overhead is 100 microsecond and restart overhead is 100 microsecond,
compute for EAT (effective access time) when using each of the Page replacement algorithms.
d. How much is the performance degradation (for each PRA)?
e. If the tolerable performance degradation in 15%, what should be the allowable (maximum) page fault rate
(for each PRA)?

4.

Given a demand paging system with eight (8) frames. Pages are labeled by the process name and page number
(ex, B2 is page 2 of process B). Given is the sequence of pages already referenced and brought in:
A4, A9, A8, A7, B6, B9, B8, B6, B3, C3, C5, C3, C5, C4, C9
Assume that the resulting memory content is shown in table 2 below (using some X page replacement algorithm):
Table 2
Frame #
Page #
0
B6
1
A4
2
B3
3
C4
4
A9
5
C9
6
A8
7
A7

Continue simulating the reference string below using local Least Recently Used replacement algorithm
A1, A2, A3, A2, A4, A5, A4, A3, A2, A3, A2, A1, A2, A3, A2, A1, A4, A5, A6, A7

th
th
10
20
th
th
Show the memory map after the 10 and 20 page references.
5.

Consider the two-dimensional array A:


int A[][] = new int[100][100];

where A[0][0] is at location 200 in a paged memory system with pages of size 200. A small process that manipulates the
matrix (see program code below) resides in page 0 (locations 0 to 199). Thus, every instruction fetch will be from page 0.
For three page frames, how many page faults are generated by the following array-initialization loops, using LRU
replacement and assuming that page frame 1 contains the process and the other two are initially empty?
A. Program Code 1

B.

Program Code 2

6.

Given 4 processes (P1, P2, P3 and P4) which require 10, 8, 12, and 16 pages of memory respectively, determine
the total number of frames to be allocated for each process and the number of free frames available using
equal allocation and proportional frame allocation algorithms for a memory size of :
a. 32 frames
b. 64 frames.

7.
8.

Discuss how Windows XP and Solaris implement Virtual Memory


Summarize and reflect on Chapter 9.

You might also like