* Yahav Biran <[EMAIL PROTECTED]> [061105 12:39]:
> My application does from time to time swap. I can see it by monitoring it
> with vmstat command (si and so parameters).
> I would like to know why this swap activity was made (lack of memory or
> memory algorithm).

swap out is done when a process uses memory it asked for and there isn't
enough free physical memory to provide for this use. Memory which is
allocated to a process but is not in physical memory generates a page
fault and in this page fault the OS will try to allocate a physical
page. The OS keeps a set of free physical pages and tries to keep a
minimum number of them available, if it dipped below that minimum it
will start to swap out some other pages.

swap in is done when tehre is a memory access on a virtual page that
doesn't have a physical allocation. The page fault will load the page
from the swap and the app will continue to work.

In order to trace this activity you can use systemtap to put traces into
the kernel, but it's not really a simple task and you are not even
guaranteed to have a meaningful information since the swap-out isn't done
(normally) in direct response to a specific physical page allocation so
it might be tricky to account swap-out to some action. swap-in is
directly accountable to the program action but it's not very
interesting, except in orderto change the program algorithms to improve
them in face of swapping activity.

Cheers,
Baruch

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to