Please note that this question is specific to linux only. And by swap space, I mean the dedicated swap partition.
I did google a bit on this, and found these definitions:
Paging refers to writing portions, termed pages, of a process’ memory to disk.
Swapping, strictly speaking, refers to writing the entire process, not just part, to disk.
In Linux, true swapping is exceedingly rare, but the terms paging and swapping
often are used interchangeably.
and
page-out: The system's free memory is less than a threshold "lotsfree" and unnused / least used pages are moved to the swap area.
page-in: One process which is running requested for a page that is not in the current memory (page-fault), it's pages are being brought back to memory.
swap-out: System is thrashing and has deactivated 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.
Now, you may want to duplicate this question with the ones asking about differences between paging and swapping. But I seek a bit more. At any point of time, are these counters in /proc/vmstat mutually exclusive? By that, I mean, does the parameter pswpin include some counts from pgpgin or vice-verse? What exactly happens when a process is deactivated? If all of its pages are moved to swap space, then how exactly is it different from multiple pageouts? Also, if a pagein occurs whenever a page fault occurs, what can one say about the other two parameters pgmajfault and pgfault with respect to this event? Is it the case that whenever a pagefault (major? minor?) occurs, a corresponding pagein also occurs?
It would be helpful if some example programs/benchmarks are suggested to test these individual parameters.
PS: I may keep adding/editing the questions :)