¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾
Points: 100 points
Due: Week 14, Tuesday, November 25, 2003
1. (10 pnts) Problem 4 in the textbook on page 451.
Here is a solution:
a. 2200 byte block
b. 1000 byte block
c. 2200 byte block
d. 2200 byte block
e. 2200 byte block
f. 2200 byte block
2. (10 pnts) Problem 5 in the textbook on page 451.
The free list is a list of blocks eligible for allocation. The list could be organized so that when it is searched for a particular strategy, the search time is small.
3. (10 pnts) Problem 6 in the textbook on page 452.
Here is a solution
4. (10 pnts) Problem 2 in the textbook on pages 506.
Since the virtual address size is the page size times the number of pages, then it is reasonable to assume that 2g+h represents the fact that there are 2g pages or address per page, and 2h addresses per page or pages. Similarly, since the process uses 2 h+k addresses as a set of page frames of the same size, the number of page frames or the page frame size is 2h and the page frame size or the number of page frames allocated to the process is 2k. Since 2h appears in both expressions, and since a page frame must be the same size as a page, we infer that 2h is the page and page frame size, 2g is the number of pages in the virtual address space, and that 2k is the number of page frames allocated to the process.
A virtual address is g+h bits wide.
5. (10 pnts) Problem 3 in the textbook on page 506.
1KB = 1,024 bytes.
a. 899 is offset 899 in page 0.
b. 23456 is offset 928 in page 22.
c. 0x3F244 is offset 0x244 (580 decimal) in page 0xFC (252 decimal).
d. 0x0017C is offset 0x17C (380 decimal) in page 0.
6. (15 pnts) Problem 4 in the textbook on page 506 (note that it should be 64-entry page middle directory, instead of 32-entry one).
If you assume a 32-entry page middle directory, your answer will be different.
The size of the page middle directory should be 64 instead of 32 entries. This gives a template for an address as follows:
bits 0:9 - 10-bit offset
bits 10:17 - 8-bit pte
bits 18:23 - 6-bit pmd
bits 24:31 - 8-bit pgd
1. (25 pnts) Problem 11 in the textbook on pages 506-507.
The page reference stream is 3 2 4 3 4 2 2 3 4 5 6 7 7 6 5 4 5 6 7 2 1.
Frame 3 2 4 3 4 2 2 3 4 5 6 7 7 6 5 4 5 6 7 2 1
0 |
3 |
3 |
3 |
3 |
3 |
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|
2 |
2 |
2 |
|
|
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
4 |
|
4 |
4 |
4 |
4 |
4 |
4 |
3 |
|
|
|
|
|
|
|
|
|
5 |
5 |
5 |
5 |
5 |
5 |
5 |
5 |
5 |
5 |
5 |
5 |
4 |
|
|
|
|
|
|
|
|
|
|
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
6 |
5 |
|
|
|
|
|
|
|
|
|
|
|
7 |
7 |
7 |
7 |
7 |
7 |
7 |
7 |
7 |
7 |
alloc |
1 |
2 |
3 |
3 |
3 |
3 |
3 |
3 |
3 |
4 |
5 |
6 |
5 |
4 |
3 |
4 |
4 |
4 |
4 |
5 |
6 |
2. (10 pnts) Problem 17 in the textbook on page 507.
Note that this is just one possible scenario and there are many other possible solutions.
Suppose the page replacement algorithm is LRU, the page frame allocation is 3, and the loop is loaded in 2 pages, but every instruction references 2 data pages, e.g., the code has the form:
for (...) {
y = f(x);
---- page boundary ----
y = g(x);
}
Since the 2 data pages are referenced on every instruction, these pages will not be unloaded, leaving only one page for the instructions. When the process executes the top half of the loop, the page containing the code for the top half of the loop, including y = f(x), is loaded, but when the code for the bottom half of the loop is executed, including y = g(x), the first code page is unloaded and the second is loaded. That is, each time through the loop there will be a missing page fault for the code pages.