docx

advertisement
ICS 143: Principles of Operating Systems
Due Date: Thu, 4 June 2015, 11:55 PM via EEE DropBox (PDF file)
Homework #4 (Total Marks=100)
Question 1: Paging Segmentation (26 = 2 * 13 points)
Given the following segment table:
Segment
0
1
2
3
4
5
Base
100
1332
500
3221
2200
4871
Length
300
750
600
80
500
99
1. What are the physical addresses for the following logical addresses (indicate
if it’s invalid)? (X, Y): segment X, address Y
a) (0, 155)
b) (1, 761)
c) (2, 32)
d) (3, 80)
e) (4, 361)
f) (5, 0)
g) (5, 1)
2. If the above segments are the only segments in the system, i.e. there is only 1
process, and all segments are full, fill the base address table after a disk
compaction done.
Segment
Base
0
1
2
3
4
5
Question 2: Replacement (60 = 3 x 20 points)
Consider the following page reference string:
e, c, b, e, a, g, d, c, e, g, d, a
With 4 frames, how many page faults would occur with the following page
replacement algorithms? Fill in the tables accordingly.
RS: reference strings; F0: frame 0, F1: frame 1, etc.
Hint: all frames are initially empty, so your first unique pages will all cost one fault
each.
1. Optimal
Time
1
RS
e
F0
F1
F2
F3
Page fault?
Total page fault:
2. LRU
Time
1
RS
e
F0
F1
F2
F3
Page fault?
Total page fault:
2
c
3
b
4
e
5
a
6
g
7
d
8
c
9
e
10
g
11
d
12
a
2
c
3
b
4
e
5
a
6
g
7
d
8
c
9
e
10
g
11
d
12
a
8
c
9
e
10
g
11
d
12
a
3. LRU approximation algorithm: Second chance
Time
1
2
3
4
5
6
7
RS
e
c
b
e
a
g
d
F0
F1
F2
F3
Page fault?
Total page fault:
Question 3: Paging and TLB (14 points)
A computer keeps its space tables in memory. The overhead required for reading a
word from the page table is 3 microseconds. To reduce this overhead, the computer
has TLB, which holds pairs (virtual page, physical page frame), and can do a lookup
in 500 nanoseconds. What hit rate is needed to reduce the mean overhead to 1500
nanoseconds for reading a word from page table?
Note: Show your steps; final answer is not enough.
Download