10.1
Under what circumstances do page faults occur? Describe the actions taken by the oper-atingsystem when a page fault occurs.
Ans: A page fault occurs when an access to a page that has not been brought into
main memory takes place. The operating system verifies the memory access, aborting the
program if it is invalid. If it is valid, a free frame is located and I/Ois requested to read
the needed page into the free frame. Upon completion of I/O, the process table and page
table are updated and the instruction is restarted.
10.5 Assume we have a demand-paged memory. The page table is held in registers. It takes 8
milliseconds to service a page fault if an empty page is available or the replaced page is
not modified, and 20 milliseconds if the replaced page is modified. Memory access time
is 100 nanoseconds.
Assume that the page to be replaced is modified 70 percent of the time. What is the maxi-mum
acceptable page-fault rate for an effective access time of no more than 200 nanosec-onds?
Ans:
0.2 _sec = (1 _ P) _ 0.1 _sec + (0.3P) _ 8 millisec + (0.7P) _ 20 millisec
0.1 = _ 0.1P + 2400 P + 14000 P
0.1 ' 16,400 P
P ' 0.000006
10.9 Consider a demand paging system with the following time measured utilizations :
CPU utilizaton 20%
Paging disk 97.7%
Other I/O devices 5%
Which (if any) of the following will (probably) improve CPU utilization? Explain your
answer.
a. Install a faster CPU.
b. Install a bigger paging disk.
c. Increase the degree of multiprogramming.
d. Decrease the degree of multiprogramming.
e. Install more main memory.
f. Install a faster hard disk or multiple controllers with multiple hard disks.
g. Add prepaging to the page fetch algorithms.
h. Increase the page size.
Ans:
The system obviously is spending most of its time paging, indicating over-allocation
of memory. If the level of multiprogramming is reduced resident processes
would page fault less frequently and the CPU utilization would improve. Another way to
improve performance would be to get more physical memory or a faster paging drum.
d. Decrease the degree of multiprogramming—Yes.
e. Install more main memory—Likely to improve CPU utilization as more pages can
remain resident and not require paging to or from the disks.
f. Install a faster hard disk, or multiple controllers with multiple hard disks—Also an
improvement, for as the disk bottleneck is removed by faster response and more
throughput to the disks, the CPU will get more data more quickly.
g. Add prepaging to the page fetch algorithms—Again, the CPU will get more data
faster, so it will be more in use. This is only the case if the paging action is amenable
to prefetching (i.e., some of the access is sequential).
h. Increase the page size—Increasing the page size will result in fewer page faults if
data is being accessed sequentially. If data access is more or less random, more
paging action could ensue because fewer pages can be kept in memory and more
data is transferred per page fault. So this change is as likely to decrease utilization
as it is to increase it.
10.11 Consider the following page reference string:
1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6.
How many page faults would occur for the following replacement algorithms, assuming
one, two, three, four, five, six, or seven frames? Remember all frames are initially empty,
so your first unique pages will all cost one fault each.
_
LRU replacement_
FIFO replacement_
Optimal replacementAns:
Number of Frames |
LRU |
FIFO |
OPTIMAL |
1 |
20 |
20 |
20 |
2 |
18 |
18 |
15 |
3 |
15 |
16 |
11 |
4 |
10 |
14 |
8 |
5 |
8 |
10 |
7 |
6 |
7 |
10 |
7 |
7 |
7 |
7 |
7 |
10.17
Consider a demand-paging system with a paging disk that has an average access andtransfer time of 20 milliseconds. Addresses are translated through a page table in main
memory, with an access time of 1 microsecond per memory access. Thus, each memory
reference through the page table takes two accesses. To improve this time, we have added
an associative memory that reduces access time to one memory reference, if the page-table
entry is in the associative memory.
Assume that 80 percent of the accesses are in the associative memory and that, of the
remaining, 10 percent (or 2 percent of the total) cause page faults. What is the effective
memory access time?
Answer:
effective access time = (0.8) _ (1)
+ (0.18)(2)+ (0.02)(20002) microseconds
= 401.16 microseconds