Operating System - HP-UX
1820404 Members
3535 Online
109624 Solutions
New Discussion юеВ

swapin, swapout, pagein and page out

 
SOLVED
Go to solution
Nguyen Anh Tien
Honored Contributor

swapin, swapout, pagein and page out

I am confusing with 4 concepts(swapin, swapout, pagein and page out). what it indicates and how it relatives to system performence
HP is simple
7 REPLIES 7
Sanjay Kumar Suri
Honored Contributor

Re: swapin, swapout, pagein and page out

pagein: pages paged in per second
pageout: pages paged out per second
swapin: pages swapped in per second
swapout: pages swapped out per second

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
Muthukumar_5
Honored Contributor

Re: swapin, swapout, pagein and page out

hai,

swapin and swapout is used to swap files/devices to or from swap memory devices / location.
They are the counts of swap IO to do swaping of the files/devices operation to or from swap memory.

pagein and pageout are used for the Virtual Memory initiated IO and operation on file-system memory.
They are the counts for VMIO without considering where the operation is done at file-system memory or swap memory.

Regards,
Muthukumar.
Easy to suggest when don't know about the problem!
Sanjay Kumar Suri
Honored Contributor
Solution

Re: swapin, swapout, pagein and page out

Memory space is allocated to processes in units known as "pages".

Using demand paging, an OS (HP-UX) brings portions of a process into memory as needed, and pushes pages that haven't been recently referenced out to disk.

The kernel always tries to maintain a threshold of free pages in order to keep the system running effectively. As long as this threshold is maintained, no paging occurs.

When the number of free pages drops below this threshold, vhand daemon selects pages that haven't been referenced, copied them out to swap (page-out) and adds pages to the free page list.

A page fault occurs when a process tries to access a page that is not currently in memory. The page will then be copied into RAM via a page-in.

When the free memory falls below another threshold (minfree), the swapper daemon deactivates processes which prevents them from running and thus reduces the rate at which new pages are accessed.

This gives vhand an opportunity to send the unreferenced pages out to swap and free pages in physical memory.

Two much of swapping affects system performance as most of the time CPU is busy doing this kind of activity leaving little time to complete the running processes. Response time is badly affected.

sks

A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
Ted Buis
Honored Contributor

Re: swapin, swapout, pagein and page out

From a performance standpoint, you really want 0 (or some very small number) of page outs. Since disk access is ~1000x slower than RAM access, page outs (and back in) can have a huge impact. Page-ins occur naturally, as pages may not be loaded until they are needed. Naturally, a high number might be of concern, but page-in rates greater than zero are typically common. If page-outs are high, consider more RAM.
Mom 6
Bill Hassell
Honored Contributor

Re: swapin, swapout, pagein and page out

swapping refers to the old concept of removing and entire program to make room for another. This can be very ineffiecient if only a couple of megs are needed. Now, programs are first deactivated which makes them a candidate for paging, and then a few pages are moved to swap (page out area). To reactivate the program, a few pages are returned and the program continues. You can ignore swap as a term as it doesn't really exist in HP-UX now. Legacy Unix programs like vmstat, sar and top still refer to the paging area as swap.

NOTE: page out is the only metric of interest. Page in always includes the startup of new programs as well as pssible pages returning from swap back to memory. Therefore, page in is virtually useless as a performance metric.


Bill Hassell, sysadmin
D Block 2
Respected Contributor

Re: swapin, swapout, pagein and page out

if you want to study the performance of an executable, study how the Swapper works in ther kernel. Also, look at "chatr" and its various options to change normal page "in's". The larger the page size, the most likely the less demand-paging or "page-Faults".

# man chatr

The +pd and +pi options only provide a hint for the virtual memory
page size. The actual page sizes may vary. Under certain conditions,
page size hints of L may result in better performance, depending on
the specific memory requirements of the application.


you might study the performance behavior of lazy swap:

chatr:

see size of: Data pages
see size of: Instr pages.

chatr:
+z Enable lazy swap on all data segments (using PA32 chatr
or PA64 chatr FORMAT 1) or on a specific segment (using
PA64 ELF chatr FORMAT 2). May not be used with non-
data segments.


Golf is a Good Walk Spoiled, Mark Twain.
KapilRaj
Honored Contributor

Re: swapin, swapout, pagein and page out

The way I understand,

page-out === The system's free memory is less than a threhsold "lotsfree" and vhand daemon used "LFU" algorithm to move some unused / least used pages to the swap area.

page-in === One process which is running requested for a page that is not in the current memory (page-fault), vhand daemon is bringing it's pages to memory.

swap-out === System is thrashing and swapper daemon has de-activated a process and it's memory pages are moved into the swap area.

swap-in === A deactivated process is back to work and it's pages are being brought into the memory.

Regds,

Kaps
These are the words from Rahman's certification guide
Nothing is impossible