3014

Assume the program is running on a system using demand paging, and the page size
is 1 kB. Each integer is 4 bytes long. It is clear that each array requires a 16-page
space. As an example, A[0, 0]-A[0, 63], A[1, 0]-A[1, 63], A[2, 0]-A[2, 63], and A[3, 0]-
A[3, 63] will be stored in the first data page. A similar storage pattern can be derived
for the rest of array A and for arrays B and C. Assume the system allocates a 4-page
working set for this process. One of the pages will be used by the program, and three
pages can be used for the data. Also, two index registers are assigned for i and j (so
no memory accesses are needed for references to these two variables).
a. Discuss how frequently the page fault would occur (in terms of number of
times C[i, j]=A[i, j]+B[i, j]C[i, j]=A[i, j]+B[i, j] are executed).
b. Can you modify the program to minimize the page fault frequency?
c. What will be the frequency of page faults after your modification?
8.4. Consider the following string of page references 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2.
Complete a figure similar to Figure 8.14, showing the frame allocation for:
a. FIFO (first-in-first-out)
b. LRU (least recently used)
c. Clock
d. Optimal (assume the page reference string continues with 1, 2, 0, 1, 7, 0, 1)
e. List the total number of page faults and the miss rate for each policy. Count
page faults only after all frames have been initialized. Document Preview:

Homework-3 Operating System chapter 8 8.1. Suppose the page table for the process currently executing on the processor looks like the following. All numbers are decimal, everything is numbered starting from zero, and all addresses are memory byte addresses. The page size is 1,024 bytes. Virtual page Valid Reference Modify Page frame number bit bit bit number 0 1 1 0 4 1 1 1 1 7 2 0 0 0 – 3 1 0 0 2 4 0 0 0 – 5 1 0 1 0 a. Describe exactly how, in general, a virtual address generated by the CPU is translated into a physical main memory address. b. What physical address, if any, would each of the following virtual addresses correspond to? (Do not try to handle any page faults, if any.) i. 1,052 ii. 2,221 iii. 5,499 8.2. Consider the following program. #define Size 64 int A[Size; Size], B[Size; Size], C[Size; Size]; int register i, j; for (j = 0; j

Attachments:

Homework-3.pdf