Swap space


The system swap space is "raw disk," a collection of disk blocks the kernel can use as it wishes, without any specific structure associated with it. This can be a complete disk partition or perhaps a swap file. The kernel will use these pages as a backing store, or place to put pages that have to be saved for later use and cannot be retrieved from some file elsewhere. Swap space is used to hold the pages that are bumped out of main memory and cannot be put back into a named file. These may be pages used for a stack, or data space for which a program has allocated memory. Such pages, known as "anonymous" pages, don't have a home anywhere else and need a temporary shelter on swap space.

In the SunOS 4.x kernel, the pages in main memory are considered to be merely a cache for pages on disk. This means that when a new page is requested by a process for anonymous use, that page immediately must have corresponding disk space in swap reserved for it, so that in case it does need to be pushed out to disk there will be a place to put it. This is fairly straightforward but does have some disadvantages.

One disadvantage is that the total amount of pages (virtual memory address range) in use by all the processes in the system for data can be no larger than swap space. This doesn't count code that can be retrieved from an executable file, or memory-mapped data files, but any private data must be backed up by a swap page.

As another disadvantage, the amount of physical memory usable by programs is restricted by the amount of swap that has been defined. If you have a machine with 500 megabytes of main memory but only 100 megabytes of swap, much of your physical memory will be useless because there is not enough swap space to back up all the pages on disk. You may never actually have to page anything out ” there may never be a small enough free list to force the page daemon to start running ” but the system still requires that reservation, "just in case."

In Solaris 2, these restrictions have been relaxed somewhat. The method is more intelligent : The total amount of virtual address space available to processes is the sum of swap plus physical memory. Systems can be built (if enough physical memory is available) without any swap space at all. These systems, of course, are going to have a lot of trouble creating a system core file: There's no place to put it!



PANIC. UNIX System Crash Dump Analysis Handbook
PANIC! UNIX System Crash Dump Analysis Handbook (Bk/CD-ROM)
ISBN: 0131493868
EAN: 2147483647
Year: 1994
Pages: 289
Authors: Chris Drake

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net