The following is a demonstration of the anonpgpid.d script,


Here we run it on a system that is implementing memory caps using the
resource capping daemon, "rcapd",

   # anonpgpid.d
   Tracing... Hit Ctrl-C to end.
   ^C
      PID CMD              D BYTES
     6215 bash             R 8192
     6215 bash             W 126976
     5809 rcapd            R 245760
     6222 memleak.pl       R 974848
     6222 memleak.pl       W 3055616

The "memleak.pl" process consumes memory, and we can see above that it has
encountered both reads and writes to the physical swap device - it is being
paged out. A bash shell was also effected (which was in the same project that
rcapd was monitoring). 



The following is an ordinary system that is very low on memory,

   # anonpgpid.d
   Tracing... Hit Ctrl-C to end.
   ^C
      PID CMD              D BYTES
    18885 sendmail         R 4096
    18600 automountd       R 4096
        1 init             R 4096
     2456 inetd            R 8192
    18546 nscd             R 8192
     2400 bash             R 12288
      217 utmpd            R 28672
      221 ttymon           R 32768
      210 sac              R 36864
    18777 snmpd            R 49152
    18440 init             R 49152
       89 nscd             R 61440
      318 syslogd          R 73728
      487 snmpd            R 81920
     2453 inetd            R 102400
      165 in.routed        R 131072
      294 automountd       R 135168
      215 inetd            R 135168
      187 rpcbind          R 204800
       86 kcfd             R 290816
        7 svc.startd       R 1015808
        9 svc.configd      R 1478656
        2 pageout          W 23453696

The "pageout" process is responsible for writing all the anonymous memory
pages to the physical swap device, and we can see from the above that it 
has written 23 Mb. When processes access anonymous memory that has been
swapped out, a major fault occurs and the memory is paged back in; in this
case we can trace the process that was effected, and from the above we can
see that several processes have been effected by the memory pressure.
The most is "svc.configd", which needed to page back in 1.4 Mb of anonymous
memory. 



Sometimes anonpgpid.d doesn't help too much. Here we only have pageouts
to the physical swap device and no pageins,

   # anonpgpid.d
   ^C
      PID CMD              D BYTES
        2 pageout          W 61083648

Only pageout is identified. 
