The assignment is to be handed in class. No late assignments will be accepted.
What is reentrant code? Explain why sharing a reentrant module is easier when segmentation is used than when pure paging is used.
----------------------
Consider a paging system with the page table stored in memory.
Given memory partitions of 300K, 350K, 190K, 600K, 250K and 700K(in order), how would each of the
a. First-fit
b. Next-fit
c. Best-fit
d. Worst-fit
algorithms place processes of 255K, 450K, 185K, 310K, 650K(in order)? For first-fit algorithm, searching starts
at the beginning of the set of holes every time. For next-fit algorithm, searching starts at the beginning of the set
of holes the first time.
var A: array[1..200]of array [1..200] of integer;
Where A[1][1] is at location 200, in a paged memory system with pages of size 200. A small process is in page 0(location 0 to 199) for manipulating the matrix; 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 repacement, and assuming page frame 1 has the process in it, and the other two are initially empty:
a. for j:= 1 to 200 do
for i:= 1 to 200 do
A[i][j]:=0;
b. for i:= 1 to 200 do
for j:= 1 to 200 do
A[i][j]:=0;
-----------------------
Consider the following page reference string:
A B C D B A E F C D B C G E B A B D F G
How many page faults would occur for the following replacement algorithms, assuming
four frames? Remember all frames are initially
empty, so your first unique pages will all cost one fault each. Please show complete working and how you have arrived
at the answer.
For the following reference string:
A C F B C E B C F D A E F F C D A A D E
In the following problem, main memory consists of 64 10-bit words. The contents of main memory are as follows:
|
Address |
Contents |
Address |
Contents |
Address |
Contents |
Address |
Contents |
|
0 |
778 |
16 |
681 |
32 |
315 |
48 |
75 |
|
1 |
488 |
17 |
842 |
33 |
733 |
49 |
468 |
|
2 |
50 |
18 |
147 |
34 |
713 |
50 |
538 |
|
3 |
64 |
19 |
611 |
35 |
423 |
51 |
173 |
|
4 |
411 |
20 |
508 |
36 |
23 |
52 |
14 |
|
5 |
389 |
21 |
333 |
37 |
667 |
53 |
915 |
|
6 |
121 |
22 |
795 |
38 |
191 |
54 |
877 |
|
7 |
793 |
23 |
285 |
39 |
590 |
55 |
25 |
|
8 |
470 |
24 |
234 |
40 |
17 |
56 |
911 |
|
9 |
293 |
25 |
238 |
41 |
866 |
57 |
505 |
|
10 |
29 |
26 |
318 |
42 |
639 |
58 |
0 |
|
11 |
152 |
27 |
687 |
43 |
594 |
59 |
65 |
|
12 |
480 |
28 |
801 |
44 |
172 |
60 |
408 |
|
13 |
830 |
29 |
192 |
45 |
88 |
61 |
268 |
|
14 |
16 |
30 |
611 |
46 |
741 |
62 |
654 |
|
15 |
168 |
31 |
45 |
47 |
816 |
63 |
237 |
Note: the addresses in the problems below are virtual addresses. The normal convention is to place the most significant portion of the address in the most significant bits of the address. Thus, the virtual addresses below will be formatted as follows:
paging
page # | word #
Consider an operating system using paging. Main memory is
divided into 4-word page frames. In a page table descriptor, the low order bits
contain the frame in which the page resides. To the left of the frame number is
the residency bit and the remaining bits are used by the operating system
(protection, whether the page has been modified, etc.).
Thus the page descriptor looks like:
OS ResidencyBit Frame#
The page table pointer for a process points to address 27. Give the results of the following memory references by that process:
a. 60
b. 18
c. 47
d. 25