Showing results for 
Search instead for 
Did you mean: 

virtual and swap

Super Advisor

virtual and swap

Hi Admins,

I have heard that swap memory and virtual memory both are the same.
But why we use 2 different commands swapinfo and vmstat ?
I know that swap is part of HDD
but when virtual memory comes in to picture..

When idle processes are sent to swap from RAM and vice versa its called as pagein and pageout

But this p0 and pi status shown in vmstat not swapinfo

m really confused..plz help me

Pete Randall
Outstanding Contributor

Re: virtual and swap

This is a good paper to start with:


Esteemed Contributor

Re: virtual and swap

VM is a concept that increase the memory size the system can present than the real physical memory. Swap is a technique which fulfills this concept.

Re: virtual and swap

swapinfo just defines how much swap and whether reserved or used.
vmstat gives more info on the current performance.
James R. Ferguson
Acclaimed Contributor

Re: virtual and swap

Hi Himacs:

To add to Dennis's comments, remember that every process has to "reserve" swap space so that it is available should the process ever need it (be paged out).

If you don't have sufficient swap space, forking a new process will result in ENOMEM (errno 12).

Whether or not your process ever uses the reservation is dependent upon memory pressure. If pages of a process are paged-out, the actual I/O that occurs is seen in the 'po' column of 'vmstat'. When values in this column begin to reach double-digits, your performance has degraded.


Hakki Aydin Ucar
Honored Contributor

Re: virtual and swap

Swapinfo and vmstat ; They are totaly different commands as Dennis said:

Check this out about detailed vmstat:
Kranti Mahmud
Honored Contributor

Re: virtual and swap

Hi himacs,

swapinfo â system paging space information. swapinfo prints information about device and file system paging space. (Note: the term `swap' refers to an obsolete implementation of virtual memory; HP-UX actually implements virtual memory by way of paging rather than swapping. This command and others retain names derived from `swap' for historical reasons.) For more details check it:

vmstat-vmstat â report virtual memory statistics. The vmstat command reports certain statistics kept about process, virtual memory, trap, and CPU activity. It also can clear the accumulators in the kernel sum structure. For more details check it:

Dont look BACK as U will miss something INFRONT!