52
While the first three actions are relatively straightforward, the last one is not. For that, we need to
cover some additional topics.
4.4.2. The Working Set
The group of physical memory pages currently dedicated to a specific process is known as the working
set for that process. The number of pages in the working set can grow and shrink, depending on the
overall availability of pages on a system-wide basis.
The working set grows as a process page faults. The working set shrinks as fewer and fewer free pages
exist. To keep from running out of memory completely, pages must be removed from process's work-
ing sets and turned into free pages, available for later use. The operating system shrinks processes'
working sets by:
Writing modified pages to a dedicated area on a mass storage device (usually known as swapping
•
or paging space)
Marking unmodified pages as being free (there is no need to write these pages out to disk as they
•
have not changed)
To determine appropriate working sets for all processes, the operating system must track usage in-
formation for all pages. In this way, the operating system determines which pages are actively being
used (and must remain memory resident) and which pages are not (and therefore, can be removed
from memory.) In most cases, some sort of least-recently used algorithm determines which pages are
eligible for removal from process working sets.
4.4.3. Swapping
While swapping (writing modified pages out to the system swap space) is a normal part of a sys-
tem's operation, it is possible to experience too much swapping. The reason to be wary of excessive
swapping is that the following situation can easily occur, over and over again:
Pages from a process are swapped
•
The process becomes runnable and attempts to access a swapped page
•
The page is faulted back into memory (most likely forcing some other processes' pages to be
•
swapped out)
A short time later, the page is swapped out again
•
If this sequence of events is widespread, it is known as thrashing and is indicative of insufficient RAM
for the present workload. Thrashing is extremely detrimental to system performance, as the CPU and
I/O loads that can be generated in such a situation quickly outweigh the load imposed by a system's
real work. In extreme cases, the system may actually do no useful work, spending all its resources
moving pages to and from memory.
4.5. Virtual Memory Performance Implications
While virtual memory makes it possible for computers to more easily handle larger and more complex
applications, as with any powerful tool, it comes at a price. The price in this case is one of performance
— a virtual memory operating system has a lot more to do than an operating system incapable of
supporting virtual memory. This means that performance is never as good with virtual memory as it
is when the same application is 100% memory-resident.
Chapter 4. Physical and Virtual Memory
Need help?
Do you have a question about the ENTERPRISE LINUX 3 - INTRODUCTION TO SYSTEM ADMINISTRATION and is the answer not in the manual?
Questions and answers