Solaris Virtual Memory

Virtual memory combines RAM and dedicated disk storage areas known as swap space. Virtual memory management software maps copies of files on disk to virtual addresses. Programs use these virtual addresses rather than real addresses to store instructions and data. Virtual memory makes it possible for the operating system (OS) to use a large range of memory. However, the kernel must translate the virtual memory addresses into real address in RAM before the actual program instruction is performed on a central processing unit (CPU).

Physical RAM

Physical memory refers to the actual RAM installed on a computer. When working with swap space, RAM is the most critical resource in your system. The amount of physical memory varies depending on the system that runs the Solaris 10 OS. The code for each active process and any data required by each process must be mapped into physical memory before execution can take place.

Virtual and Physical Addresses

The Solaris 10 OS virtual memory management system maps the files on disk to virtual addresses in virtual memory. The virtual memory management system then translates the virtual addresses into real, physical addresses in physical memory, because programs require instructions or data in these files. The CPU uses the data and instructions when they are placed in physical memory.

Anonymous Memory Pages

Physical memory pages associated with a running process can contain private data or stack information that does not exist in any file system on disk. Since these memory pages contain information that is not also a named file on the disk, these pages are known as anonymous memory pages. Anonymous memory pages are backed by swap space; in other words, swap space is used as a temporary storage location for data while it is swapped out of memory.

Swap Space

While the amount of physical memory in a system is constant, the use of the physical memory varies. Often processes conflict over which one gets access to physical memory space. Sometimes a process must give up some of its memory space allocation to another process. The process has some of its pages in RAM paged out. Anonymous memory pages are placed in a swap area, but unchanged file system pages are not placed in swap areas, because file system data exists as permanent storage on the disk, and can be removed from physical memory.

Swap Slices

The primary swap space on the system is a disk slice. In the Solaris 10 OS, the default location for the primary swap space is slice 1 of the boot disk, which by default, starts at cylinder 0. You can change the default location during a custom installation. Each time you reboot the system, an entry in the /etc/vfstab file determines the configuration of the swap partition. As additional swap space becomes necessary, you can configure additional swap slices. Plan your swap slice location carefully. If you have additional storage space outside of the system disk, place the swap slice on an additional drive to reduce the load on the system disk drive.

Swap Files

It is also possible to provide additional swap space on a system by using swap files. Swap files are files that reside on a file system, and that have been created using the mkfile command. These files might be useful in some cases. For example, swap files are useful when additional swap space is required, but there are no free disk slices and reslicing a disk to add more swap is not a practical solution. Swap files can be permanently included in the swap configuration by creating an entry for the swap file in the /etc/vfstab file.

The swapfs File System

When the kernel runs a process, swap space for any private data or stack space for the process must be reserved. The reservation occurs in case the stack information or private data might need to be paged out of physical memory, for example, if there are multiple processes contending for limited memory space.

Because of the virtual swap space provided by the swapfs file system in the Solaris 10 OS, there is less need for physical swap space on systems with a large available memory. The decreased need for physical swap space occurs because the swapfs file system provides virtual swap space addresses rather than real physical swap space addresses in response to swap space reservation requests. Therefore, you need physical swap space on disk, only in the event that the physical RAM pages containing private data need to be paged out.

The image shows that the swap space resides outside the physical RAM as a swap partition or as a swap file.


Paging

Paging is the transfer of selected memory pages between RAM and the swap areas. When you page private data to swap spaces, physical RAM is made available for other processes to use. If you need the pages that were paged out, you can retrieve them (page them in) from swap and map them back into physical memory. Moving these pages back into RAM might require more paging (page outs) of other process’s pages to make room. Swapping is the movement of all modified data memory pages associated with a process, between RAM and a disk.

Use the pagesize command to display the size of a memory page in bytes. The default page size for the Solaris 10 OS is 8192 bytes.

# pagesize
8192

You can use the Multiple Page Size Support (MPSS) service to run legacy applications with larger memory page sizes. Using larger page sizes can significantly improve the performance of programs using large amounts of memory. Large pages must be mapped to addresses that are multiples of the page size. Use the pagesize command to display all supported page sizes.

# pagesize -a
8192
65536
524288
4194304

Swapping does not typically occur in the Solaris OS. However, the requirement within the Solaris OS to reserve swap space prior to executing any process, makes it necessary that some amount of swap space is available. The required amount of swap space varies from system to system. The amount of available swap space must satisfy two criteria:

  • It must be sufficient to supplement physical RAM to meet the needs of concurrently running processes.
  • It must be sufficient to hold a crash dump (in a single slice).


Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA * Time limit is exhausted. Please reload the CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.