[AIX 운영 체제와 장치 관리 38] 페이징 공간과 가상 메모리 — 지연·조기 할당(PSALLOC), 기본 크기, mkps·chps·swapon, hd6 줄이기와 옮기기, 문제 해결, VMM

핵심 정리

  • 페이징 공간은 형이 paging인 논리 볼륨(또는 NFS 파일)으로, 사용 가능한 페이징 총량은 활성 페이징 공간 크기의 합입니다. 부족하면 프로세스가 죽고 바닥나면 시스템이 패닉할 수 있습니다.
  • 기본은 지연(deferred) 할당이라 실제로 page-out할 때 블록을 잡아 과다 약정이 생길 수 있고, 그때 SIGDANGER 뒤 SIGKILL을 보냅니다. PSALLOC=early면 요청 때 미리 잡아 부족하면 malloc 등이 실패하며 SIGKILL은 받지 않습니다(물리 메모리의 4배 정도로 시작).
  • 기본 크기는 최소 16MB(hd6는 64MB), 디스크의 20% 이하, 실제 메모리 256MB 미만이면 그 두 배, 이상이면 512MB입니다. 성능을 위해 디스크 가운데에 두고 물리 볼륨마다 나눠 둡니다.
  • hd6는 chps(shrinkps)로 안전하게 줄이고 migratepv -l hd6 hdisk0 hdisk2로 같은 VG 안에서 재부팅 없이 옮기되, rootvg 밖으로는 옮기지 않습니다. 기본 덤프 장치이면 먼저 sysdumpdev로 바꿉니다.
  • VMM은 4KB 페이지와 페이지 프레임으로 메모리를 관리하며, free list를 유지하려고 page-out·page steal을 합니다. 영속 세그먼트는 파일 자리로, 작업 세그먼트는 페이징 공간으로 나가며, thrashing을 메모리 부하 제어로 다룹니다.
항목 내용
버전 AIX 6.1 (5.3판과 거의 같음, 구성·문제 해결 절 정리)
원문 Operating system and device management — 5.3판 7987쪽, 6.1판 404413쪽
관련 명령어 lsps -s, mkps, chps -a·-c·-d, rmps, swapon, swapoff, sysdumpdev -P -p, migratepv -l hd6, vmo
관련 파일 /etc/swapspaces

AIX는 가상 메모리를 써서 시스템에 물리적으로 있는 것보다 많은 메모리를 주소 지정합니다.

RAM이나 디스크의 메모리 페이지 관리는 가상 메모리 관리자(VMM)가 맡습니다. 가상 메모리 세그먼트는 페이지라는 단위로 나뉩니다. 페이징 공간은 디스크 공간이 할당된 논리 볼륨의 한 종류로, 가상 메모리에 있지만 지금 접근하지 않는 정보를 저장합니다. 이 논리 볼륨은 속성 형이 paging이며 보통 페이징 공간이나 스왑 공간이라고 부릅니다. 시스템의 빈 RAM이 적으면 최근에 쓰지 않은 프로그램이나 데이터를 메모리에서 페이징 공간으로 옮겨 다른 활동에 메모리를 내줍니다.

영어 원문

Paging space and virtual memory

AIX uses virtual memory to address more memory than is physically available in the system.

The management of memory pages in RAM or on disk is handled by the Virtual Memory Manager (VMM). Virtual-memory segments are partitioned in units called pages. A paging space is a type of logical volume with allocated disk space that stores information which is resident in virtual memory but is not currently being accessed. This logical volume has an attribute type equal to paging, and is usually simply referred to as paging space or swap space. When the amount of free RAM in the system is low, programs or data that have not been used recently are moved from memory to paging space to release memory for other activities.

페이징 공간 개념

페이징 공간은 디스크 공간이 할당된 논리 볼륨의 한 종류로, 가상 메모리에 있지만 지금 접근하지 않는 정보를 저장합니다.

이 논리 볼륨은 속성 형이 paging이며 보통 페이징 공간이나 스왑 공간이라고 부릅니다. 시스템의 빈 RAM이 적으면 최근에 쓰지 않은 프로그램이나 데이터를 메모리에서 페이징 공간으로 옮겨 다른 활동에 메모리를 내줍니다.

NFS 서버를 페이징 공간 저장소로 쓰는 장치로 접근하는 다른 종류의 페이징 공간도 있습니다. NFS 클라이언트가 이 페이징 공간에 접근하려면 NFS 서버에 파일을 만들어 그 클라이언트에 내보내야 합니다. 파일 크기가 클라이언트의 페이징 공간 크기입니다.

필요한 페이징 공간 양은 시스템에서 하는 활동 종류에 달려 있습니다. 페이징 공간이 모자라면 프로세스를 잃을 수 있고, 바닥나면 시스템이 패닉할 수 있습니다. 페이징 공간 부족 상태가 감지되면 페이징 공간을 더 정의합니다.

논리 볼륨 페이징 공간은 새 페이징 공간 논리 볼륨을 만들거나 기존 페이징 공간 논리 볼륨의 크기를 키워 정의합니다. NFS 페이징 공간의 크기를 키우려면 서버에서 알맞은 작업으로 서버에 있는 파일을 키워야 합니다.

시스템이 페이징에 쓸 수 있는 총 공간은 모든 활성 페이징 공간 논리 볼륨 크기의 합입니다.

관련 개념

  • 페이징 공간 문제 해결

페이징 공간 할당 정책

PSALLOC 환경 변수가 지연(deferred)과 조기(early) 가운데 어느 페이징 공간 할당 알고리즘을 쓸지 정합니다.

AIX는 페이징 공간 할당에 두 모드를 씁니다. 기본은 지연입니다. PSALLOC 환경 변수 값을 바꿔 조기 페이징 공간 할당 모드로 바꿀 수 있지만, 그 전에 고려할 요인이 여럿 있습니다. 조기 할당 알고리즘을 쓰면 최악의 경우 쓸 수 있는 페이징 공간을 모두 써 시스템이 크래시할 수 있습니다.

지연과 조기 페이징 공간 할당 비교

운영 체제는 PSALLOC 환경 변수로 메모리와 페이징 공간 할당 메커니즘을 정합니다.

PSALLOC 환경 변수가 설정되지 않았거나, null이거나, early가 아닌 값이면 시스템은 기본 deferred 할당 알고리즘을 씁니다.

deferred 할당 알고리즘은 디스크 자원을 효율적으로 쓰게 돕고, 자원 관리에 희소 할당 알고리즘을 선호하는 응용 프로그램을 지원합니다. 이 알고리즘은 메모리 요청 때 페이징 공간을 예약하지 않습니다. 페이징 공간의 디스크 블록 할당은 요청한 페이지를 page-out해야 할 때까지 미룹니다. 어떤 프로그램은 가상 메모리를 많이 할당하고 그 일부만 씁니다. 희소 벡터나 행렬을 자료 구조로 쓰는 기술 응용 프로그램이 그 예입니다. 지연 할당 알고리즘은 이 운영 체제의 것처럼 실시간 요구 페이징 커널에도 더 효율적입니다.

이 페이징 공간은 끝내 쓰이지 않을 수도 있습니다. 특히 실제 메모리가 커서 페이징이 드문 시스템이 그렇습니다. 지연 알고리즘은 요청한 페이지를 page-out해야 할 때까지 페이징 공간 할당을 미뤄 페이징 공간을 낭비하지 않습니다. 이렇게 미루면 지연 알고리즘이 시스템에 있는 것보다 많은 페이징 공간을 할당하려 하는 경우가 생길 수 있습니다. 이를 페이징 공간 과다 약정(over-commitment)이라고 합니다.

과다 약정 상황에서 페이징 공간이 바닥났는데 페이지를 page-out하려고 페이징 공간 디스크 블록을 할당하려 하면 실패합니다. 운영 체제는 과다 약정의 영향을 받는 프로세스를 죽여 시스템 전체 실패를 피하려 합니다. 빈 페이징 공간이 적다고 프로세스에 알리려고 SIGDANGER 신호를 보냅니다. 페이징 공간 상황이 더 위급해지면 SIGDANGER 신호를 받지 않은(원문 그대로) 고른 프로세스에 SIGKILL 신호를 보냅니다.

PSALLOC 환경 변수로 early 할당 알고리즘으로 바꿀 수 있습니다. 이 알고리즘은 메모리를 요청할 때 실행 중인 프로세스의 페이징 공간을 할당합니다. 요청 때 페이징 공간이 모자라면 조기 할당 메커니즘은 메모리 요청을 실패시킵니다.

PSALLOC 환경 변수를 early로 설정하면 그때부터 그 환경에서 시작하는 모든 프로그램(이미 실행 중인 프로세스는 제외)이 조기 할당 환경에서 실행됩니다. 조기 할당 환경에서는 요청 때 페이징 공간을 충분히 예약할 수 없으면 malloc 서브루틴과 brk 서브루틴 같은 인터페이스가 실패합니다.

조기 할당 환경 모드로 실행하는 프로세스는 페이징 공간 부족 상태가 생겨도 SIGKILL 신호를 받지 않습니다.

PSALLOC 환경 변수를 early로 바꾸는 방법은 변경을 얼마나 넓게 적용할지에 따라 여러 가지입니다.

조기 할당 환경으로 바꾸면 다음 메모리 할당 인터페이스 서브루틴이 영향을 받습니다.

malloc, free, calloc, realloc, brk, sbrk, shmget, shmctl

관련 작업

  • 조기 할당 모드를 위한 PSALLOC 환경 변수 구성

조기 할당 모드

조기 할당 알고리즘은 메모리 할당 요청이 요구하는 만큼의 페이징 공간을 보장합니다. 그래서 효율적으로 운영하려면 시스템 디스크에 페이징 공간을 올바르게 할당하는 것이 중요합니다.

쓸 수 있는 페이징 공간이 일정 문턱 아래로 떨어지면 새 프로세스를 시작할 수 없고 실행 중인 프로세스도 메모리를 더 얻지 못할 수 있습니다. 기본 지연 할당 모드로 실행 중인 프로세스는 SIGKILL 신호 메커니즘에 아주 취약해집니다. 또 운영 체제 커널도 때로 메모리 할당이 필요하므로 쓸 수 있는 페이징 공간을 모두 쓰면 시스템이 크래시할 수 있습니다.

시스템 전체에서 조기 할당 모드를 쓰기 전에 시스템에 충분한 페이징 공간을 정의하는 것이 아주 중요합니다. 조기 할당 모드에 필요한 페이징 공간은 거의 늘 기본 지연 할당 모드보다 큽니다. 얼마나 정의할지는 시스템을 어떻게 쓰고 어떤 프로그램을 실행하는지에 달려 있습니다. 알맞은 양을 정하는 좋은 출발점은 물리 메모리의 네 배인 페이징 공간을 정의하는 것입니다.

어떤 응용 프로그램은 조기 할당 모드로 실행하면 페이징 공간을 엄청나게 쓸 수 있습니다. AIXwindows 서버는 조기 할당 모드로 실행하면 지금 250MB가 넘는 페이징 공간이 필요합니다. 응용 프로그램에 필요한 페이징 공간은 응용 프로그램을 어떻게 작성하고 실행하는지에 달려 있습니다.

페이징 공간과 프로세스 메모리 사용을 보여 주는 모든 명령과 서브루틴은 조기 할당 모드로 할당한 페이징 공간을 포함합니다. lsps 명령은 -s 플래그로 조기 할당 모드로 할당한 것을 포함한 총 페이징 공간 할당을 보여 줍니다.

페이징 공간 기본 크기

기본 페이징 공간 크기는 AIX 설치의 시스템 사용자 정의 단계에서 다음 기준으로 정합니다.

  • 페이징 공간은 16MB 이상이어야 합니다. 단 hd6는 64MB 이상이어야 합니다.
  • 페이징 공간은 총 디스크 공간의 20%를 넘을 수 없습니다.
  • 실제 메모리가 256MB 미만이면 페이징 공간은 실제 메모리의 두 배입니다.
  • 실제 메모리가 256MB 이상이면 페이징 공간은 512MB입니다.

페이징 공간 파일, 명령, 옵션

/etc/swapspaces 파일은 페이징 공간과 그 속성을 지정합니다.

mkps 명령으로 페이징 공간을 만들면 /etc/swapspaces 파일에 더해지고, rmps 명령으로 지우면 파일에서 빠집니다. 파일의 페이징 공간 속성은 chps -a나 chps -c 명령으로 바꿉니다. 이전 형식(스탠자에 체크섬 크기와 자동 swap-on 속성이 없는) 파일도 계속 지원합니다. 페이징 공간이 너무 크면 chps -d 명령으로 재부팅 없이 페이징 공간에서 논리 파티션을 뺄 수 있습니다.

페이징 공간 관리에는 다음 명령을 씁니다.

명령 설명
chps 페이징 공간의 속성을 바꿉니다.
lsps 페이징 공간의 특성을 보여 줍니다.
mkps 페이징 공간을 더합니다. 페이징 공간 논리 볼륨을 만들 때 mkps 명령은 특정 옵션 묶음으로 mklv 명령을 씁니다. NFS 페이징 공간을 만들 때는 다른 옵션 묶음으로 mkdev 명령을 씁니다. NFS 페이징 공간에는 NFS 서버의 호스트 이름과 서버가 내보낸 파일의 경로 이름이 필요합니다.
rmps 비활성 페이징 공간을 지웁니다.
swapoff 시스템을 재부팅하지 않고 페이징 공간 하나 이상을 비활성화합니다. 페이징 공간의 정보는 다른 활성 페이징 공간으로 옮겨집니다. 비활성화한 페이징 공간은 rmps 명령으로 지울 수 있습니다.
swapon 페이징 공간을 활성화합니다. 초기 시스템 초기화 때 첫 페이징 공간 장치를 활성화하는 데 쓰고, 나중 초기화 단계에서 다른 장치를 쓸 수 있게 되면 페이징 활동이 여러 장치에 걸쳐 일어나도록 다른 페이징 공간을 활성화하는 데 씁니다.

모든 논리 볼륨 페이징 공간에는 paging 형 옵션이 필요합니다.

논리 볼륨으로 페이징 성능을 최대화하려면 다음 옵션을 씁니다.

  • 디스크 암 이동을 줄이도록 디스크 가운데에 할당합니다.
  • 페이징 공간을 여럿 쓰고 각각 별도 물리 볼륨에서 할당합니다.
영어 원문

Paging space concepts

A paging space is a type of logical volume with allocated disk space that stores information, which is located in virtual memory but is currently not being accessed.

This logical volume has an attribute type equal to paging, and is usually simply referred to as paging space or swap space. When the amount of free RAM in the system is low, programs or data that have not been used recently are moved from memory to paging space to release memory for other activities.

Another type of paging space is available that can be accessed through a device that uses an NFS server for paging-space storage. For an NFS client to access this paging space, the NFS server must have a file created and exported to that client. The file size represents the paging space size for the client.

The amount of paging space required depends on the type of activities performed on the system. If paging space runs low, processes can be lost, and if paging space runs out, the system can panic. When a paging-space low condition is detected, define additional paging space.

The logical volume paging space is defined by making a new paging-space logical volume or by increasing the size of existing paging-space logical volumes. To increase the size of an NFS paging space, the file that resides on the server must be increased by the correct actions on the server.

The total space available to the system for paging is the sum of the sizes of all active paging-space logical volumes.

Related concepts

Troubleshooting paging space The most common problem regarding paging space is caused by running out of allocated space.

Paging space allocation policies

The PSALLOC environment variable determines which paging space allocation algorithm is used: deferred or early.

AIX uses two modes for paging space allocation. The default is deferred. You can switch to an early paging space allocation mode by changing the value of the PSALLOC environment variable, but there are several factors to consider before making such a change. When using the early allocation algorithm, in a worst-case scenario, it is possible to crash the system by using up all available paging space.

Comparisons of deferred and early paging space allocation:

The operating system uses the PSALLOC environment variable to determine the mechanism used for memory and paging space allocation.

If the PSALLOC environment variable is not set, is set to null, or is set to any value other than early, the system uses the default deferred allocation algorithm.

The deferred allocation algorithm helps the efficient use of disk resources and supports applications that prefer a sparse allocation algorithm for resource management. This algorithm does not reserve paging space when a memory request is made; the disk block allocation of paging space is delayed until it is necessary to page out the requested page. Some programs allocate large amounts of virtual memory and then use only a fraction of the memory. Examples of such programs are technical applications that use sparse vectors or matrices as data structures. The deferred allocation algorithm is also more efficient for a real-time, demand-paged kernel such as the one in the operating system.

This paging space might never be used, especially on systems with large real memory where paging is rare. The deferred algorithm delays allocation of paging space until it is necessary to page out the requested page, which results in no wasted paging space allocation. This delayed allocation can result in a case where the deferred algorithm can try to allocate more paging space than the space available to the system. This situation is called an over-commitment of paging space.

In the over-commitment scenario, where paging space becomes exhausted and an attempt is made to allocate a paging space disk block to page out a page, a failure results. The operating system attempts to avoid complete system failure by killing processes affected by the paging space over-commitment. The SIGDANGER signal is sent to notify processes that the amount of free paging space is low. If the paging space situation reaches an even more critical state, selected processes that did not receive the SIGDANGER signal are sent a SIGKILL signal.

You can use the PSALLOC environment variable to switch to an early allocation algorithm, which allocates paging space for the executing process at the time the memory is requested. If there is insufficient paging space available at the time of the request, the early allocation mechanism fails the memory request.

If the PSALLOC environment variable is set to early, then every program started in that environment from that point on, but not including currently running processes, runs in the early allocation environment. In the early allocation environment, interfaces such as the malloc subroutine and the brk subroutine will fail if sufficient paging space cannot be reserved when the request is made.

Processes run in the early allocation environment mode are not sent the SIGKILL signal if a low paging space condition occurs.

There are different ways to change the PSALLOC environment variable to early, depending on how broadly you want to apply the change.

The following memory allocation interface subroutines are affected by a switch to an early allocation environment:

  • malloc

  • free

  • calloc

  • realloc

  • brk

  • sbrk

  • shmget

  • shmctl

Related tasks

Configuring the PSALLOC environment variable for early allocation mode The operating system uses the PSALLOC environment variable to determine the mechanism used for

memory and paging space allocation.

Early allocation mode:

The early allocation algorithm guarantees as much paging space as requested by a memory allocation request. Thus, correct paging space allocation on the system disk is important for efficient operations.

When available paging space drops below a certain threshold, new processes cannot be started and currently running processes might not be able to get more memory. Any processes running under the default deferred allocation mode become highly vulnerable to the SIGKILL signal mechanism. In addition, because the operating system kernel sometimes requires memory allocation, it is possible to crash the system by using up all available paging space.

Before you use the early allocation mode throughout the system, it is very important to define an adequate amount of paging space for the system. The paging space required for early allocation mode is almost always greater than the paging space required for the default deferred allocation mode. How much paging space to define depends on how your system is used and what programs you run. A good starting point for determining the right mix for your system is to define a paging space four times greater than the amount of physical memory.

Certain applications can use extreme amounts of paging space if they are run in early allocation mode. The AIXwindows server currently requires more than 250 MB of paging space when the application runs in early allocation mode. The paging space required for any application depends on how the application is written and how it is run.

All commands and subroutines that show paging space and process memory use include paging space allocated under early allocation mode. The lsps command uses the -s flag to display total paging space allocation, including paging space allocated under early allocation mode.

Paging space default size

The default paging space size is determined during the system customization phase of AIX installation according to the following standards.

  • Paging space can use no less than 16 MB, except for hd6 that can use no less than 64 MB.

  • Paging space can use no more than 20% of total disk space.

  • If real memory is less than 256 MB, paging space is two times real memory.

  • If real memory is greater than or equal to 256 MB, paging space is 512 MB.

Paging space file, commands, and options

The /etc/swapspaces file specifies the paging spaces and the attributes of the paging spaces.

A paging space is added to the /etc/swapspaces file when it is created by the mkps command, and a paging space is removed from the /etc/swapspaces file when it is deleted by the rmps command. The paging space attributes in the file are modified by the chps -a command or the chps -c command. Files using a previous format (where there are no attributes for checksum size and automatic swap-on in the stanzas) continue to be supported. If the paging space size is too large, you can subtract logical partitions from the paging space without rebooting using the chps -d command.

The following commands are used to manage paging space:

  • chps — Changes the attributes of a paging space.
  • lsps — Displays the characteristics of a paging space.
  • mkps — Adds an additional paging space. The mkps command uses the mklv command with a specific set of options when creating a paging space logical volume. To create NFS paging spaces, the mkps command uses the mkdev command with a different set of options. For NFS paging spaces, the mkps command needs the host name of the NFS server and the path name of the file that is exported from the server.
  • rmps — Removes an inactive paging space.
  • swapoff — Deactivates one or more paging space without rebooting the system. Information in the paging space is moved to other active paging space areas. The deactivated paging space can then be removed using the rmps command.
  • swapon — Activates a paging space. The swapon command is used during early system initialization to activate the initial paging-space device. During a later phase of initialization, when other devices become available, the swapon command is used to activate additional paging spaces so that paging activity occurs across several devices.

The paging type option is required for all logical volume paging spaces.

The following options are used to maximize paging performance with a logical volume:

  • Allocate in the middle of the disk to reduce disk arm travel

  • Use multiple paging spaces, each allocated from a separate physical volume.

페이징 공간 구성

많은 구성 작업은 Web-based System Manager나 SMIT로 할 수 있습니다. 페이징 공간과 메모리 할당은 PSALLOC 환경 변수로 제어합니다.

페이징 공간 더하기와 활성화

시스템이 페이징 공간을 쓸 수 있게 하려면 페이징 공간을 더하고 활성화해야 합니다.

총 페이징 공간 양은 시행착오로 정하는 경우가 많습니다. 흔히 쓰는 지침은 RAM 크기의 두 배를 페이징 공간 목표로 삼는 것입니다. Web-based System Manager 마법사로 페이징 공간을 늘리려면 Volumes 컨테이너, Paging Space 컨테이너를 차례로 고르고 Selected 메뉴에서 Increase Paging Space → Wizard를 고릅니다.

SMIT를 쓰려면 명령행에서 다음 빠른 경로 가운데 하나를 입력합니다.

  • 현재 페이징 공간을 나열하려면 smit lsps
  • 페이징 공간을 더하려면 smit mkps
  • 페이징 공간을 활성화하려면 smit swapon

관련 작업

  • 같은 볼륨 그룹 안에서 hd6 페이징 공간 옮기기

페이징 성능 높이기

페이징 성능을 높이려면 페이징 공간을 여럿 쓰고 되도록 별도 물리 볼륨에 둡니다.

그러나 한 물리 볼륨에 페이징 공간을 둘 이상 둘 수도 있습니다. 여러 물리 볼륨을 쓸 수 있지만, 시스템을 잘 알지 못하면 rootvg 볼륨 그룹 안의 디스크만 고르는 것이 좋습니다.

조기 할당 모드를 위한 PSALLOC 환경 변수 구성

운영 체제는 PSALLOC 환경 변수로 메모리와 페이징 공간 할당 메커니즘을 정합니다.

기본 설정은 late(원문 그대로, 곧 deferred)입니다. 다음 예는 PSALLOC 환경 변수를 early로 바꾸는 여러 방법입니다. 어떤 방법을 고를지는 변경을 얼마나 넓게 적용할지에 달려 있습니다.

  • 셸 명령행에서 다음 명령을 입력합니다.
text
PSALLOC=early;export PSALLOC

그 셸 세션에서 이후 실행하는 모든 명령이 조기 할당 모드로 실행됩니다.

  • 셸 자원 파일(.shrc나 .kshrc)에 다음 명령을 넣습니다.
text
PSALLOC=early;export PSALLOC

로그인 셸을 뺀 로그인 세션의 모든 프로세스가 조기 할당 모드로 실행됩니다. 이 방법은 프로세스를 SIGKILL 신호 메커니즘에서도 보호합니다.

  • 프로그램 안에 putenv 서브루틴을 넣어 PSALLOC 환경 변수를 early로 설정합니다. 이 방법을 쓰면 다음 exec 서브루틴 호출 때 조기 할당 동작이 효과를 냅니다.

관련 개념

  • 지연과 조기 페이징 공간 할당 비교

페이징 공간 바꾸기와 지우기

페이징 공간을 바꾸는 것은 Web-based System Manager나 SMIT로 쉽게 할 수 있지만, 지우는 것은 더 위험합니다.

페이징 공간의 특성을 바꾸려면 Web-based System Manager를 쓰거나 명령행에서 SMIT 빠른 경로 smit chps를 입력합니다.

페이징 공간을 지우는 절차는 더 위험하며, 특히 지우려는 페이징 공간이 hd6 같은 기본 페이징 공간이면 그렇습니다. 기본 페이징 공간은 시스템을 구성하는 셸 스크립트가 부팅 때 활성화하므로 지우려면 특별한 절차가 필요합니다. 기본 페이징 공간을 지우려면 이 스크립트를 바꾸고 새 부트 이미지를 만들어야 합니다.

주의: 기본 페이징 공간을 잘못 지우면 시스템이 다시 시작하지 못할 수 있습니다. 다음 절차는 숙련된 시스템 관리자만 씁니다.

기존 페이징 공간을 지우려면 다음 절차를 씁니다.

  1. root 권한으로 명령행에서 다음 SMIT 빠른 경로를 입력해 페이징 공간을 비활성화합니다.
text
smit swapoff
  1. 지우려는 페이징 공간이 기본 덤프 장치이면 페이징 공간을 지우기 전에 기본 덤프 장치를 다른 페이징 공간이나 논리 볼륨으로 바꿔야 합니다. 기본 덤프 장치를 바꾸려면 다음 명령을 입력합니다.
text
sysdumpdev -P -p /dev/ new_dump_device
  1. 다음 빠른 경로를 입력해 페이징 공간을 지웁니다.
text
smit rmps

관련 개념

  • 페이징 공간 문제 해결

페이징 공간 할당 모드 프로그래밍 인터페이스 쓰기

페이징 공간 할당 모드를 제어하는 프로그래밍 인터페이스는 PSALLOC 환경 변수를 씁니다.

응용 프로그램이 늘 원하는 모드(조기 페이징 공간 할당 여부)로 실행되게 하려면 다음을 합니다.

  1. getenv 서브루틴으로 PSALLOC 환경 변수의 현재 상태를 살핍니다.
  2. PSALLOC 환경 변수 값이 응용 프로그램에 필요한 값이 아니면 setenv 서브루틴으로 환경 변수 값을 바꿉니다. execve 서브루틴만 PSALLOC 환경 변수 상태를 살피므로, 응용 프로그램이 받은 것과 같은 매개변수와 환경으로 execve 서브루틴을 호출합니다. 응용 프로그램이 PSALLOC 환경 변수 상태를 다시 살펴 올바른 값을 찾으면 정상적으로 계속합니다.
  3. getenv 서브루틴으로 본 PSALLOC 환경 변수의 현재 상태가 올바르면 바꿀 필요가 없습니다. 응용 프로그램은 정상적으로 계속합니다.

hd6 페이징 공간 옮기기와 줄이기

덜 바쁜 다른 디스크로 페이징과 스와핑을 보내 저장 시스템 성능을 높이려고 기본 페이징 공간을 줄이거나 옮길 수 있습니다. 기본 페이징을 줄이거나 옮기면 hdisk0의 디스크 공간도 아낍니다.

옮기든 크기를 줄이든 이유는 같습니다. 페이징 공간 활동을 덜 바쁜 디스크로 옮기는 것입니다. 기본 설치는 바쁜 /(루트)와 /usr 파일 시스템의 일부나 전부가 있는 hdisk0에 페이징 논리 볼륨(hd6)을 만듭니다. 최소 디스크 간 할당 정책을 골라 / 전부와 /usr 대부분이 hdisk0에 있으면, 페이징 공간을 덜 바쁜 디스크로 옮기면 성능이 크게 좋아질 수 있습니다. 최대 디스크 간 할당 정책을 구현해 /와 /usr가 여러 물리 볼륨에 퍼져 있어도, (디스크 셋이라 하면) hdisk2에는 가장 바쁜 파일 시스템에 속한 논리 파티션이 적을 가능성이 큽니다.

다음 절차는 hd6 페이징 공간을 줄이는 방법과 같은 볼륨 그룹 안에서 옮기는 방법입니다.

관련 개념

  • 디스크 간 할당 정책, 페이징 공간 문제 해결

hd6 페이징 공간 줄이기

다음 절차는 chps 명령으로 1차 페이징 공간과 1차·2차 덤프 장치를 포함한 기존 페이징 공간을 줄입니다.

chps 명령은 shrinkps 스크립트를 호출하며, 이 스크립트는 시스템을 부팅할 수 없는 상태로 만들지 않고 안전하게 페이징 공간을 줄입니다. 스크립트는 구체적으로 다음을 합니다.

  1. 같은 볼륨에 임시 페이징 공간을 만듭니다.
  2. 정보를 그 임시 공간으로 옮깁니다.
  3. 같은 볼륨에 더 작은 새 페이징 공간을 만듭니다.
  4. 이전 페이징 공간을 지웁니다.

chps 명령이 성공하려면 임시 페이징 공간을 만들 빈 디스크 공간(어느 논리 볼륨에도 할당되지 않은 공간)이 충분해야 합니다. 임시 페이징 공간 크기는 이전 페이징 공간의 page-out된 모든 페이지를 담을 공간과 같습니다. 1차 페이징 공간의 최소 크기는 32MB, 다른 페이징 공간의 최소 크기는 16MB입니다.

참고: 다음 절차에서 I/O 오류가 나면 시스템을 바로 종료하고 재부팅해야 할 수 있습니다.

  1. 다음 명령을 입력해 물리 볼륨에 걸친 논리 볼륨과 파일 시스템 분포를 확인합니다.
text
lspv -l hdiskX

hdiskX는 물리 볼륨 이름입니다. 2. 페이징 공간 크기를 줄이려면 명령행에서 다음을 입력합니다.

text
smit chps

참고: 1차 페이징 공간은 부트 레코드에 박혀 있습니다. 그래서 시스템을 다시 시작하면 1차 페이징 공간은 늘 활성화됩니다. chps 명령은 1차 페이징 공간을 비활성화할 수 없습니다.

운영 가능한 구성을 유지하는 것이 우선입니다. 시스템 검사로 페이징 공간 줄이기를 바로 거부할 수 있습니다. 임시 페이징 공간을 만드는 동안 오류가 나면 절차가 끝나고 시스템은 원래 설정으로 돌아갑니다. 다른 문제는 시스템 관리자의 개입이나 즉시 재부팅이 필요한 상황을 일으킬 수 있습니다. 어떤 오류는 임시 페이징 공간을 지우지 못하게 할 수 있습니다. 이 경우 보통 관리자가 급하지 않게 손보면 됩니다.

주의: shrinkps 스크립트 안의 swapoff 명령이 시스템 백킹 페이지나 사용자 백킹 페이지에서 I/O 오류를 감지하면, 시스템 크래시를 피하려면 바로 종료하는 것이 좋습니다. 재부팅하면 임시 페이징 공간이 활성이며, I/O 오류를 만난 응용 프로그램을 멈췄다가 다시 시작해 볼 수 있습니다. 성공해 swapoff 명령이 비활성화를 마칠 수 있으면 mkps, swapoff, rmps 명령으로 필요한 크기의 페이징 공간을 만들고 임시 페이징 공간을 지워 줄이기 절차를 직접 마칠 수 있습니다.

시스템을 다시 시작하기 전에 I/O ERROR 상태였던 비활성 페이징 공간을 (rmps로) 지우거나 (chps로) 다시 활성화하려 하지 않습니다. 디스크 공간이 재사용돼 문제가 더 생길 위험이 있습니다.

같은 볼륨 그룹 안에서 hd6 페이징 공간 옮기기

기본 페이징 공간을 hdisk0에서 같은 볼륨 그룹의 다른 디스크로 옮기는 데는 시스템 종료와 재부팅이 필요 없습니다.

root 권한으로 다음 명령을 입력해 기본(hd6) 페이징 공간을 hdisk0에서 hdisk2로 옮깁니다.

text
migratepv -l hd6 hdisk0 hdisk2

주의: hd6라는 이름의 페이징 공간을 rootvg에서 다른 볼륨 그룹으로 옮기는 것은 권하지 않습니다. 부팅 둘째 단계와 이동식 매체로 부팅할 때 루트 볼륨 그룹에 접근하는 과정을 포함한 여러 곳에 이름이 박혀 있기 때문입니다. 부팅 둘째 단계에는 rootvg의 페이징 공간만 활성이므로 rootvg에 페이징 공간이 없으면 부팅 성능에 크게 영향을 줄 수 있습니다. 페이징 공간 대부분을 다른 볼륨 그룹에 두고 싶으면 hd6를 되도록 작게(물리 메모리와 같은 크기로) 하고 다른 볼륨 그룹에 더 큰 페이징 공간을 만드는 것이 낫습니다.

관련 개념

  • 페이징 공간 더하기와 활성화
영어 원문

Configuring paging space

Many of the configuring tasks can be done with Web-based System Manager or SMIT. Paging space and memory allocation is controlled by the PSALLOC environment variable.

Adding and activating paging space

To make paging space available to your system, you must add and activate the paging space.

The total amount of paging space is often determined by trial and error. One commonly used guideline is to double the RAM size and use that figure as a paging space target. To use the Web-based System Manager wizard to increase paging space, select the Volumes container, then the Paging Space container. From the Selected menu, choose Increase Paging Space →Wizard.

If you prefer to use SMIT, type one of the following fast paths on the command line:

  • To list your current paging space, type: smit lsps

  • To add paging space, type: smit mkps

  • To activate paging space, type: smit swapon

Related tasks

Moving the hd6 paging space within the same volume group Moving the default paging space from hdisk0 to a different disk within the same volume group does not require the system to shut down and reboot.

Improving paging performance

To improve paging performance, use multiple paging spaces and locate them on separate physical volumes whenever possible.

However, more than one paging space can be located on the same physical volume. Although you can use multiple physical volumes, it is a good idea to select only those disks within the rootvg volume group unless you are thoroughly familiar with your system.

Configuring the PSALLOC environment variable for early allocation mode:

The operating system uses the PSALLOC environment variable to determine the mechanism used for memory and paging space allocation.

The default setting is late. The following examples show different ways to change the PSALLOC environment variable to early. The method you choose depends on how broadly you want to apply the change.

  • Type the following command on a shell command line:
text
PSALLOC=early;export PSALLOC

This command causes all subsequent commands run from that shell session to run in early allocation mode.

  • Add the following command in a shell resource file (.shrc or .kshrc):
text
PSALLOC=early;export PSALLOC

This entry causes all processes in your login session, with the exception of the login shell, to run under early allocation mode. This method also protects the processes from the SIGKILL signal mechanism.

  • Insert the putenv subroutine inside a program to set the PSALLOC environment variable to early. Using this method, the early allocation behavior takes effect at the next call to the exec subroutine.

Related concepts

Comparisons of deferred and early paging space allocation The operating system uses the PSALLOC environment variable to determine the mechanism used for memory and paging space allocation.

Changing or removing a paging space

Changing a paging space is easily done with Web-based System Manager or SMIT, but removing a paging space is more risky.

Changing the characteristics of a paging space can be done with Web-based System Manager, or you can type the following SMIT fast path on the command line: smit chps.

The procedure to remove a paging space is more risky, especially if the paging space you want to remove is a default paging space, such as hd6. A special procedure is required for removing the default paging spaces, because they are activated during boot time by shell scripts that configure the system. To remove one of the default paging spaces, these scripts must be altered and a new boot image must be created.

Attention: Removing default paging spaces incorrectly can prevent the system from restarting. The following procedure is for experienced system managers only.

To remove an existing paging space, use the following procedure:

  1. With root authority, deactivate the paging space by typing the following SMIT fast path on the command line:
text
smit swapoff
  1. If the paging space you are removing is the default dump device, you must change the default dump device to another paging space or logical volume before removing the paging space. To change the default dump device, type the following command:
text
sysdumpdev -P -p /dev/ new_dump_device
  1. Remove the paging space by typing the following fast path:
text
smit rmps

Related concepts

Troubleshooting paging space The most common problem regarding paging space is caused by running out of allocated space.

Using the paging space allocation mode programming interface:

The programming interface that controls the paging space allocation mode uses the PSALLOC environment variable.

To ensure that an application always runs under the desired mode (with or without early paging space allocation), do the following:

  1. Use the getenv subroutine to examine the current state of the PSALLOC environment variable.

  2. If the value of the PSALLOC environment variable is not the value required by the application, use the setenv subroutine to alter the value of the environment variable. Because only the execve subroutine examines the state of the PSALLOC environment variable, call the execve subroutine with the same set of parameters and environment received by the application. When the application reexamines the state of the PSALLOC environment variable and finds the correct value, the application continues normally.

  3. If the getenv subroutine reveals that the current state of the PSALLOC environment variable is correct, no modification is needed. The application continues normally.

Relocating and reducing hd6 paging space

You might want to reduce or move the default paging space in order to enhance storage system performance by forcing paging and swapping to other disks in the system that are less busy. Reducing or moving the default paging also conserves disk space on hdisk0.

Whether moving the paging space or reducing its size, the rationale is the same: move paging space activity to disks that are less busy. The installation default creates a paging logical volume (hd6) on drive hdisk0, that contains part or all of the busy / (root) and /usr file systems. If the minimum inter-disk allocation policy is chosen, meaning that all of / and a large amount of /usr are on hdisk0, moving the paging space to a disk that is less busy can significantly improve performance. Even if the maximum inter-disk allocation policy is implemented and both / and /usr are distributed across multiple physical volumes, your hdisk2 (assuming three disks) likely contains fewer logical partitions belonging to the busiest file systems.

The following procedures describe how to make the hd6 paging space smaller and how to move the hd6 paging space within the same volume group.

Related concepts

Inter-disk allocation policies The inter-disk allocation policy specifies the number of disks on which the physical partitions of a logical volume are located. Troubleshooting paging space The most common problem regarding paging space is caused by running out of allocated space.

Making the hd6 paging space smaller:

The following procedure uses the chps command to shrink existing paging spaces, including the primary paging space and the primary and secondary dump device.

The chps command calls the shrinkps script, which safely shrinks the paging space without leaving the system in an unbootable state. Specifically, the script does the following:

  1. Creates a temporary paging space in the same volume

  2. Moves information to that temporary space

  3. Creates a new, smaller paging space in the same volume

  4. Removes the old paging space

For the chps command to complete successfully, enough free disk space (space not allocated to any logical volume) must exist to create a temporary paging space. The size of the temporary paging space is equal to amount of space needed to hold all the paged out pages in the old paging space. The minimum size for a primary paging space is 32 MB. The minimum size for any other paging space is 16 MB.

Note: If the following procedure encounters an I/O error, the system might require immediate shutdown and rebooting.

  1. Check your logical volume and file system distribution across physical volumes by typing the following command:
text
lspv -l hdiskX

Where hdiskX is the name of your physical volume.

  1. To shrink the paging space size, type the following on the command line:
text
smit chps

Note: The primary paging space is hardcoded in the boot record. Therefore, the primary paging space will always be activated when the system is restarted. The chps command cannot deactivate the primary paging space.

Priority is given to maintaining an operational configuration. System checks can lead to immediate refusal to shrink the paging space. Errors occurring while the temporary paging space is being created cause the procedure to exit, and the system will revert to the original settings. Other problems are likely to provoke situations that will require intervention by the system administrator or possibly an immediate reboot. Some errors may prevent removal of the temporary paging space. This would normally require non-urgent attention from the administrator.

Attention: If an I/O error is detected on system backing pages or user backing pages by the swapoff command within the shrinkps script, an immediate shutdown is advised to avoid a possible system crash. At reboot, the temporary paging space is active and an attempt can be made to stop and restart the applications which encountered the I/O errors. If the attempt is successful and the swapoff command is able to complete deactivation, the shrink procedure can be completed manually using the mkps, swapoff and rmps commands to create a paging space with the required size and to remove the temporary paging space.

Do not attempt to remove (using rmps) or reactivate (using chps) a deactivated paging space that was in the I/O ERROR state before the system restart. There is a risk that the disk space will be reused and may cause additional problems.

Moving the hd6 paging space within the same volume group:

Moving the default paging space from hdisk0 to a different disk within the same volume group does not require the system to shut down and reboot.

With root authority, type the following command to move the default (hd6) paging space from hdisk0 to hdisk2:

text
migratepv -l hd6 hdisk0 hdisk2

Attention: Moving a paging space with the name hd6 from rootvg to another volume group is not recommended because the name is hardcoded in several places, including the second phase of the boot process and the process that accesses the root volume group when booting from removable media. Only the paging spaces in rootvg are active during the second phase of the boot process, and having no paging space in rootvg could severely affect system boot performance. If you want the majority of paging space on other volume groups, it is better to make hd6 as small as possible (the same size as physical memory) and then create larger paging spaces on other volume groups..

Related concepts

Adding and activating paging space To make paging space available to your system, you must add and activate the paging space.

페이징 공간 문제 해결

페이징 공간에서 가장 흔한 문제는 할당된 공간이 바닥나는 것입니다.

총 페이징 공간 양은 시행착오로 정하는 경우가 많습니다. 흔히 쓰는 지침은 RAM 크기의 두 배를 목표로 삼는 것입니다. 페이징 공간이 모자라면 프로세스를 잃을 수 있고, 바닥나면 시스템이 패닉할 수 있습니다. 다음 신호와 오류 정보가 페이징 공간 문제를 감시하고 해결하거나 막는 데 도움이 됩니다.

운영 체제는 빈 페이징 공간 블록 수를 감시해 페이징 공간 부족을 감지합니다. 빈 페이징 공간 블록 수가 페이징 공간 경고 수준이라는 문턱 아래로 떨어지면 시스템은 SIGDANGER 신호를 보내 모든 프로세스(kproc 제외)에 이 상태를 알립니다. 부족이 이어져 페이징 공간 kill 수준이라는 둘째 문턱 아래로 떨어지면, 시스템은 페이징 공간을 많이 쓰면서 SIGDANGER 신호 처리기가 없는 프로세스에 SIGKILL 신호를 보냅니다(SIGDANGER 신호의 기본 동작은 무시입니다). 시스템은 빈 페이징 공간 블록 수가 kill 수준 위로 올라갈 때까지 SIGKILL 신호를 계속 보냅니다.

참고: (vmo 명령의) low_ps_handling 매개변수가 2이고 (SIGDANGER 처리기가 없는) 죽일 프로세스를 찾지 못하면, 시스템은 SIGDANGER 신호 처리기가 있는 가장 젊은 프로세스에 SIGKILL 신호를 보냅니다.

메모리를 동적으로 할당하는 프로세스는 psdanger 서브루틴으로 페이징 공간 수준을 감시하거나 특수 할당 루틴을 써서 페이징 공간이 충분한지 확인할 수 있습니다. disclaim 서브루틴을 써서 페이징 공간 kill 수준에 이르렀을 때 프로세스가 끝나지 않게 할 수 있습니다. 그러려면 SIGDANGER 신호 처리기를 정의하고 데이터·스택 영역과 공유 메모리 세그먼트에 할당한 메모리와 페이징 공간 자원을 풉니다.

다음과 비슷한 오류 메시지가 나오면 페이징 공간을 늘립니다.

text
INIT: Paging space is low!

또는

text
You are close to running out of paging space.
You may want to save your documents because
this program (and possibly the operating system)
could terminate without future warning when the
paging space fills up.

관련 개념

  • hd6 페이징 공간 옮기기와 줄이기, 페이징 공간 개념

관련 작업

  • 페이징 공간 바꾸기와 지우기
영어 원문

Troubleshooting paging space

The most common problem regarding paging space is caused by running out of allocated space.

The total amount of paging space is often determined by trial and error. One commonly used guideline is to double the RAM size and use that figure as a paging space target. If paging space runs low, processes can be lost, and if paging space runs out, the system can panic. The following signal and error information can help you monitor and resolve or prevent paging space problems.

The operating system monitors the number of free paging space blocks and detects when a paging-space shortage exists. When the number of free paging-space blocks falls below a threshold known as the paging-space warning level, the system informs all processes (except kprocs) of this condition by sending the SIGDANGER signal. If the shortage continues and falls below a second threshold known as the paging-space kill level, the system sends the SIGKILL signal to processes that are the major users of paging space and that do not have a signal handler for the SIGDANGER signal. (The default action for the SIGDANGER signal is to ignore the signal.) The system continues sending SIGKILL signals until the number of free paging-space blocks is above the paging-space kill level.

Note: If the low_ps_handling parameter is set to 2 (under the vmo command) and if no process was found to kill (without the SIGDANGER handler), the system will send the SIGKILL signal to the youngest processes that have a signal handler for the SIGDANGER signal.

Processes that dynamically allocate memory can ensure that sufficient paging space exists by monitoring the paging-space levels with the psdanger subroutine or by using special allocation routines. You can use the disclaim subroutine to prevent processes from ending when the paging-space kill level is reached. To do this, define a signal handler for the SIGDANGER signal and release memory and paging-space resources allocated in their data and stack areas and in shared memory segments.

If you get error messages similar to the following, increase the paging space:

text
INIT: Paging space is low!

OR

text
You are close to running out of paging space.
You may want to save your documents because
this program (and possibly the operating system)
could terminate without future warning when the
paging space fills up.

Related concepts

Relocating and reducing hd6 paging space You might want to reduce or move the default paging space in order to enhance storage system performance by forcing paging and swapping to other disks in the system that are less busy. Reducing or moving the default paging also conserves disk space on hdisk0. Paging space concepts A paging space is a type of logical volume with allocated disk space that stores information, which is located in virtual memory but is currently not being accessed.

Related tasks

Changing or removing a paging space Changing a paging space is easily done with Web-based System Manager or SMIT, but removing a paging space is more risky.

가상 메모리 관리자

가상 메모리 관리자(VMM)는 시스템과 응용 프로그램이 하는 메모리 요청을 관리합니다.

가상 메모리 세그먼트는 페이지라는 단위로 나뉩니다. 각 페이지는 실제 물리 메모리(RAM)에 있거나 필요할 때까지 디스크에 저장됩니다. AIX는 가상 메모리를 써서 시스템에 물리적으로 있는 것보다 많은 메모리를 주소 지정합니다. RAM이나 디스크의 메모리 페이지 관리는 VMM이 맡습니다.

가상 메모리 관리자의 실제 메모리 관리

AIX에서 가상 메모리 세그먼트는 페이지라는 4096바이트 단위로 나뉩니다. 실제 메모리는 4096바이트 페이지 프레임으로 나뉩니다.

VMM의 주요 기능은 둘입니다.

  • 페이지 프레임 할당을 관리합니다.
  • 지금 RAM에 없는(페이징 공간에 저장된) 가상 메모리 페이지나 아직 없는 페이지에 대한 참조를 해결합니다.

이를 위해 VMM은 쓸 수 있는 페이지 프레임의 free list를 유지합니다. VMM은 페이지 교체 알고리즘으로 지금 RAM에 있는 어떤 가상 메모리 페이지의 페이지 프레임을 free list에 다시 할당할지도 정합니다. 페이지 교체 알고리즘은 영속 세그먼트와 작업 세그먼트의 존재, 재페이징, VMM 문턱을 고려합니다.

가상 메모리 관리자의 free list

VMM은 페이지 부재를 해결하는 데 쓰는 빈(할당되지 않은) 페이지 프레임 목록을 유지합니다.

AIX는 free list에 유지하는 적은 양을 빼고 늘 RAM 전부를 쓰려고 합니다. 할당되지 않은 이 적은 페이지를 유지하려고 VMM은 page-out과 page steal로 공간을 비우고 그 페이지 프레임을 free list에 다시 할당합니다. 페이지 프레임을 다시 할당할 가상 메모리 페이지는 VMM의 페이지 교체 알고리즘으로 고릅니다.

가상 메모리 관리자의 영속·작업 메모리 세그먼트

AIX는 메모리 세그먼트 종류를 구분합니다. VMM을 이해하려면 작업 세그먼트와 영속 세그먼트의 차이를 이해하는 것이 중요합니다.

영속 세그먼트는 디스크에 영구 저장 위치가 있습니다. 데이터나 실행 프로그램이 든 파일은 영속 세그먼트에 대응됩니다. JFS나 JFS2 파일을 열어 접근하면 파일 데이터가 RAM에 복사됩니다. VMM 매개변수가 영속 페이지에 할당된 물리 메모리 프레임을 언제 덮어써 다른 데이터를 저장하는 데 쓸지 정합니다.

작업 세그먼트는 일시적이며 프로세스가 쓰는 동안에만 있습니다. 작업 세그먼트에는 영구 디스크 저장 위치가 없습니다. 프로세스의 스택과 데이터 영역은 작업 세그먼트와 공유 라이브러리 텍스트 세그먼트에 대응됩니다. 작업 세그먼트 페이지도 실제 메모리에 둘 수 없을 때는 디스크 저장 위치를 차지해야 합니다. 이 용도로 디스크 페이징 공간을 씁니다. 프로그램이 끝나면 그 작업 페이지는 모두 바로 free list로 돌아갑니다.

가상 메모리 관리자의 작업 세그먼트와 페이징 공간

RAM에 있으면서 바뀌고 page-out될 수 있는 작업 페이지에는 페이징 공간의 해당 슬롯이 할당됩니다.

할당된 페이징 공간은 페이지를 page-out해야 할 때만 씁니다. 그러나 페이징 공간에 할당된 자리는 다른 페이지가 쓸 수 없습니다. 그 페이지가 가상 메모리에 있는 동안 그 페이지 몫으로 예약돼 있습니다. 영속 페이지는 원래 있던 디스크 위치로 page-out되므로 RAM에 있는 영속 페이지에는 페이징 공간을 할당할 필요가 없습니다.

VMM은 페이징 공간 할당에 early와 late 두 모드가 있습니다. 조기 할당 정책은 작업 페이지에 대한 메모리 요청이 있을 때마다 페이징 공간을 예약합니다. 지연 할당 정책은 작업 페이지를 실제로 메모리에서 page-out할 때만 페이징 공간을 할당해 시스템의 페이징 공간 요구를 크게 줄입니다.

가상 메모리 관리자의 메모리 부하 제어 기능

프로세스가 page-out됐거나 한 번도 읽지 않아 디스크에 있는 가상 메모리 페이지를 참조하면 그 페이지를 page-in해야 하며, 쓸 수 있는(빈) 페이지 프레임이 적으면 페이지 하나 이상을 page-out할 수 있습니다. VMM은 페이지 교체 알고리즘으로 최근에 참조하지 않아 가까운 장래에 참조될 가능성이 낮은 페이지 프레임을 가져오려 합니다.

페이지 교체가 잘되면 지금 활성인 모든 프로세스의 메모리 페이지는 RAM에 남고, 비활성 프로세스의 메모리 페이지는 page-out됩니다. 그러나 RAM이 과다 약정되면 page-out할 페이지를 고르기 어려워집니다. 지금 실행 중인 프로세스가 가까운 장래에 참조할 가능성이 크기 때문입니다. 그 결과 곧 참조될 페이지가 page-out됐다가 실제로 참조될 때 다시 page-in될 수 있습니다. RAM이 과다 약정되면 끊임없는 page-in과 page-out, 곧 thrashing이 일어날 수 있습니다. thrashing 중에는 시스템이 쓸모 있는 명령을 실행하는 대신 대부분의 시간을 page-in과 page-out에 쓰며, 어느 활성 프로세스도 크게 진척하지 못합니다. VMM에는 시스템이 thrashing할 때를 감지해 바로잡으려 하는 메모리 부하 제어 알고리즘이 있습니다.

영어 원문

Virtual Memory Manager

The Virtual Memory Manager (VMM) manages the memory requests made by the system and its applications.

Virtual-memory segments are partitioned in units called pages; each page is either located in real physical memory (RAM) or stored on disk until it is needed. AIX uses virtual memory to address more memory than is physically available in the system. The management of memory pages in RAM or on disk is handled by the VMM.

Real memory management in Virtual Memory Manager

In AIX, virtual-memory segments are partitioned into 4096-byte units called pages. Real memory is divided into 4096-byte page frames.

The VMM has two major functions:

  • Manage the allocation of page frames

  • Resolve references to virtual-memory pages that are not currently in RAM (stored in paging space) or do not yet exist.

To accomplish these functions, the VMM maintains a free list of available page frames. The VMM also uses a page-replacement algorithm to determine which virtual-memory pages currently in RAM will have their page frames reassigned to the free list. The page-replacement algorithm takes into account the existence of persistent versus working segments, repaging, and VMM thresholds.

Virtual Memory Manager Free list

The VMM maintains a list of free (unallocated) page frames that it uses to satisfy page faults.

AIX tries to use all of RAM all of the time, except for a small amount which it maintains on the free list. To maintain this small amount of unallocated pages the VMM uses page outs and page steals to free up space and reassign those page frames to the free list. The virtual-memory pages whose page frames are to be reassigned are selected using the VMM's page-replacement algorithm.

Persistent or working memory segments in Virtual Memory Manager:

AIX distinguishes between different types of memory segments. To understand the VMM, it is important to understand the difference between working and persistent segments.

A persistent segment has a permanent storage location on disk. Files containing data or executable programs are mapped to persistent segments. When a JFS or JFS2 file is opened and accessed, the file data is copied into RAM. VMM parameters control when physical memory frames allocated to persistent pages should be overwritten and used to store other data.

Working segments are transitory and exist only during their use by a process. Working segments have no permanent disk storage location. Process stack and data regions are mapped to working segments and shared library text segments. Pages of working segments must also occupy disk storage locations when they cannot be kept in real memory. The disk paging space is used for this purpose. When a program exits, all of its working pages are placed back on the free list immediately.

Working segments and paging space in Virtual Memory Manager:

Working pages in RAM that can be modified and paged out are assigned a corresponding slot in paging space.

The allocated paging space is used only if the page needs to be paged out. However, an allocated page in paging space cannot be used by another page. It remains reserved for a particular page for as long as that page exists in virtual memory. Because persistent pages are paged out to the same location on disk from which they came, paging space does not need to be allocated for persistent pages residing in RAM.

The VMM has two modes for allocating paging space: early and late. Early allocation policy reserves paging space whenever a memory request for a working page is made. Late allocation policy only assigns paging space when the working page is actually paged out of memory, which significantly reduces the paging space requirements of the system.

Virtual Memory Manager memory load control facility

When a process references a virtual-memory page that is on disk, because it either has been paged out or has never been read, the referenced page must be paged in, and this might cause one or more pages to be paged out if the number of available (free) page frames is low. The VMM attempts to steal page frames that have not been recently referenced and, therefore, are not likely to be referenced in the near future, using a page-replacement algorithm.

A successful page-replacement keeps the memory pages of all currently active processes in RAM, while the memory pages of inactive processes are paged out. However, when RAM is over-committed, it becomes difficult to choose pages for page out because, they will probably be referenced in the near future by currently running processes. The result is that pages that are likely to be referenced soon might still get paged out and then paged in again when actually referenced. When RAM is over-committed, continuous paging in and paging out, called thrashing, can occur. When a system is thrashing, the system spends most of its time paging in and paging out instead of executing useful instructions, and none of the active processes make any significant progress. The VMM has a memory load control algorithm that detects when the system is thrashing and then attempts to correct the condition.