Check out the new USENIX Web site. next up previous
Next: Kernel 2.2 Up: Variations of Page Replacement Previous: Variations of Page Replacement

Kernel 2.0

Figure 1: Selecting NRU pages in Linux Kernel 2.0.
\begin{figure}\centering \centerline{\psfig{figure=fc2.0.eps,width=2.0in,height=4.5in}} \end{figure}

In Kernel 2.0, the NRU page contributions are proportionally distributed among interacting processes (see Figure 1). There is a ``swap_cnt" variable for each process, which is initialized with a quantity (RSS/1MB) proportional to its resident set size (RSS). Once an NRU page is taken away from the process, its ``swap_cnt" will be decreased by one. Only when its ``swap_cnt" becomes zero, or the searching for an NRU page fails in resident space of the process, is the next process in the process list examined. When a process with ``swap_cnt" of zero is encountered, it will be re-initialized using the same proportion rule. This strategy effectively balances memory usage by making all the processes proportionally provide NRU pages. Variable ``counter" is used to control how many processes are searched before finding an NRU page. NRU pages are identified by ``age", a variable associated with each page, which is increased by 3 with the maximum threshold of 20 when it is referenced, called page aging, and decreased by 3 each time the page is examined. Once the ``age" decreases to zero, it will become an NRU page and ready to be replaced. Page aging helps the kernel make careful distinction among active and non-active pages. When a process is forced to stay in the waiting queue for resolving page faults, the pages in its working set are more resistant to be replaced by page aging than by simply checking the reference bit of each page. However this encourages the process to spread the memory shortage burden to others, even to those with low page fault rates, by protecting its own working set.

A major disadvantage of this approach to select NRU pages is its high potential for thrashing, resulting in low CPU utilization. This is because when all the memory-intensive processes are struggling to build its working set under heavy memory loads, no one will be given a priority for the purpose of thrashing protection.


next up previous
Next: Kernel 2.2 Up: Variations of Page Replacement Previous: Variations of Page Replacement
Song Jiang 2001-09-09