Homework 3 Solution Key - Operating Systems | COP 4600, Assignments of Operating Systems

Material Type: Assignment; Class: Operating Systems; Subject: Computer Programming; University: University of Central Florida; Term: Unknown 2009;

Typology: Assignments

Pre 2010

Uploaded on 02/24/2010

koofers-user-xag
koofers-user-xag 🇺🇸

10 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
1) (60 pts 15 pts each) For the reference string shown below, determine the number of page faults
that occur for (a) FIFO replacement algorithm, (b) LRU replacement algorithm (c) Optimal
replacement algorithm. Do parts (a)-(c) for allocations of (1) three page frame allocation and (2)
four page frame allocation. Does this reference string suffer from Belady’s anomaly for the FIFO
algorithm?
Reference string: 1, 2, 3, 4, 5, 3, 4, 1, 6, 7, 8, 7, 8, 9, 7, 8, 9, 5, 4, 5, 4, 2
Three-frame allocation
FIFO
Ref. String
1
2
3
4
5
3
4
1
6
7
8
7
8
9
7
8
9
5
4
5
4
2
frame
1
1
1
1
2
3
3
3
4
5
1
6
6
6
7
7
7
7
8
9
9
9
5
2
2
2
3
4
4
4
5
1
6
7
7
7
8
8
8
8
9
5
5
5
4
3
3
4
5
5
5
1
6
7
8
8
8
9
9
9
9
5
4
4
4
2
total faults
page fault
Y
Y
Y
Y
Y
N
N
Y
Y
Y
Y
N
N
Y
N
N
N
Y
Y
N
N
Y
13
LRU
Ref. String
1
2
3
4
5
3
4
1
6
7
8
7
8
9
7
8
9
5
4
5
4
2
frame
1
1
1
1
2
3
4
5
3
4
1
6
6
6
7
8
9
7
8
9
9
9
5
2
2
2
3
4
5
3
4
1
6
7
8
7
8
9
7
8
9
5
4
5
4
3
3
4
5
3
4
1
6
7
8
7
8
9
7
8
9
5
4
5
4
2
total faults
page fault
Y
Y
Y
Y
Y
N
N
Y
Y
Y
Y
N
N
Y
N
N
N
Y
Y
N
N
Y
13
Optimal
Ref. String
1
2
3
4
5
3
4
1
6
7
8
7
8
9
7
8
9
5
4
5
4
2
frame
1
1
2
2
1
5
3
3
1
6
4
5
5
5
9
7
7
7
8
9
9
9
5
2
1
1
4
4
4
4
4
4
5
8
8
8
8
9
8
8
9
4
5
5
4
3
3
3
3
5
5
5
5
7
7
7
7
7
8
9
9
5
5
4
4
2
total faults
page fault
Y
Y
Y
Y
Y
N
N
Y
Y
Y
Y
N
N
Y
N
N
N
Y
Y
N
N
Y
13
COP 4600 Introduction To Operating Systems Summer 2009
Homework #3 100 points
KEY
pf3
pf4
pf5

Partial preview of the text

Download Homework 3 Solution Key - Operating Systems | COP 4600 and more Assignments Operating Systems in PDF only on Docsity!

1) (60 pts – 15 pts each) For the reference string shown below, determine the number of page faults

that occur for (a) FIFO replacement algorithm, (b) LRU replacement algorithm (c) Optimal

replacement algorithm. Do parts (a)-(c) for allocations of (1) three page frame allocation and (2)

four page frame allocation. Does this reference string suffer from Belady’s anomaly for the FIFO

algorithm?

Reference string: 1, 2, 3, 4, 5, 3, 4, 1, 6, 7, 8, 7, 8, 9, 7, 8, 9, 5, 4, 5, 4, 2

Three-frame allocation FIFO Ref. String 1 2 3 4 5 3 4 1 6 7 8 7 8 9 7 8 9 5 4 5 4 2 frame

3 3 4 5 5 5 1 6 7 8 8 8 9 9 9 9 5 4 4 4 2 total faults page fault Y Y Y Y Y N N Y Y Y Y N N Y N N N Y Y N N Y 13 LRU Ref. String 1 2 3 4 5 3 4 1 6 7 8 7 8 9 7 8 9 5 4 5 4 2 frame

3 3 4 5 3 4 1 6 7 8 7 8 9 7 8 9 5 4 5 4 2 total faults page fault Y Y Y Y Y N N Y Y Y Y N N Y N N N Y Y N N Y 13 Optimal Ref. String 1 2 3 4 5 3 4 1 6 7 8 7 8 9 7 8 9 5 4 5 4 2 frame

3 3 3 3 5 5 5 5 7 7 7 7 7 8 9 9 5 5 4 4 2 total faults page fault Y Y Y Y Y N N Y Y Y Y N N Y N N N Y Y N N Y 13 COP 4600 – Introduction To Operating Systems – Summer 2009 Homework # 3 – 100 points

KEY

Four-frame allocation FIFO Ref. String 1 2 3 4 5 3 4 1 6 7 8 7 8 9 7 8 9 5 4 5 4 2 frame

total faults page fault Y Y Y Y Y N N Y Y Y Y N N Y N N N Y Y N N Y 13 LRU Ref. String 1 2 3 4 5 3 4 1 6 7 8 7 8 9 7 8 9 5 4 5 4 2 frame

total faults page fault Y Y Y Y Y N N Y Y Y Y N N Y N N N Y Y N N Y 13 Optimal Ref. String 1 2 3 4 5 3 4 1 6 7 8 7 8 9 7 8 9 5 4 5 4 2 frame

total faults page fault Y Y Y Y Y N N N Y Y Y N N Y N N N N Y N N Y 11 No Belady’s anomaly for FIFO

3) (10 pts) Using the reference string from problem 1, determine the working set at each page

reference for (a) Δ = 3 and (b) Δ = 5. Determine (1) the size of the working set at each page

reference, (2) the average size of the working set (there are 22 entries in the reference string), and

(3) the total number of page faults in each case.

(a) Δ = 3

Δ = 3 Reference Working Set WS Size Page Fault 1 {1} 1 Y 2 {1,2} 2 Y 3 {1,2,3} 3 Y 4 {2,3,4} 3 Y 5 {3,4,5} 3 Y 3 {3,4,5} 3 N 4 {3,4,5} 3 N 1 {1,3,4} 3 Y 6 {1,4,6} 3 Y 7 {1,6,7} 3 Y 8 {6,7,8} 3 Y 7 {7,8} 2 N 8 {7,8} 2 N 9 {7,8,9} 3 Y 7 {7,8,9} 3 N 8 {7,8,9} 3 N 9 {7,8,9} 3 N 5 {5,8,9} 3 Y 4 {4,5,9} 3 Y 5 {4,5} 2 N 4 {4,5} 2 N 2 {2,4,5} 3 Y average size = 2. total faults = 13

(b) Δ = 5 Δ = 5 Reference Working Set WS Size Page Fault 1 {1} 1 Y 2 {1,2} 2 Y 3 {1,2,3} 3 Y 4 {1,2,3,4} 4 Y 5 {1,2,3,4,5} 5 Y 3 {2,3,4,5} 4 N 4 {3,4,5} 3 N 1 {1,3,4,5} 4 Y 6 {1,3,4,5, 6} 5 Y 7 {1,3,4,6,7} 5 Y 8 {1,4,6,7,8} 5 Y 7 {1,6,7,8} 4 N 8 {6, 7,8} 3 N 9 {7,8,9} 3 Y 7 {7,8,9} 3 N 8 {7,8,9} 3 N 9 {7,8,9} 3 N 5 {5,7,8,9} 4 Y 4 {4,5,7,8,9} 5 Y 5 {4,5,8,9} 4 N 4 {4,5,9} 3 N 2 {2,4,5} 3 Y average size = 3. total faults = 13