Page 375 - DCAP103_Principle of operating system
P. 375
Principles of Operating Systems
Notes Whenever the CPU is idle and there are free pages, they might as well as be zeroed since a
zeroed page is potentially more useful than a free page.
The existence of all these lists leads to some subtle policy choices. For example, suppose that
a page has to be brought in from disk and the free list is empty. The system is now forced to
choose between taking a clean page from the standby list (which might otherwise have been
faulted back in later) or an empty page from the zeroed page list (throwing away the work
done in zeroing it). Which is better? If the CPU is idle a lot and the zero page thread gets to
run often, taking a zeroed page is better because there is no shortage of them. However, if the
CPU is always busy and the disk is mostly idle, it is better to take a page from the standby list
to avoid the CPU cost of having to zero another page later if a stack grows.
Another puzzle, how aggressively should the daemons move pages from the modified list to the
standby list? Having clean pages around is better than having dirty pages around (since they
can be reused instantly), but an aggressive cleaning policy means more disk I/O and there is
some chance that a newly-cleaned page may be faulted back into a working set and dirtied again.
In general, Windows 2000 resolves these kinds of conflicts through complex heuristics,
guesswork, historical precedent, rules of thumb, and administrator-controlled parameter settings.
Furthermore, the code is so complex that the designers are loathe to touch parts of it for fear of
breaking something somewhere else in the system that nobody really understands any more.
To keep track of all the pages and all the lists, Windows maintains a page frame database with as
many entries as there are RAM pages, as shown in Figure 12.14. This table is indexed by physical
page frame number. The entries are fixed length, but different formats are used for different
kinds of entries (e.g., valid versus invalid). Valid entries maintain the page’s state and a count
of how many page tables point to the page, so the system can tell when the page is no longer
in use. Pages that are in a working set tell which one. There is also a pointer to the page table
pointing to the page, if any (shared pages are handled specially), a link to the next page on the
list (if any), and various other fields and flags, such as read in progress, write in progress, etc.
Figure 12.14: Some of the Major Fields in the Page Frame Database for a Valid Page
368 LOVELY PROFESSIONAL UNIVERSITY