[ILUG] "Swap-in" tool?

kevin lyda kevin+dated+1033892092.a8d043 at ie.suberic.net
Tue Oct 1 09:15:03 IST 2002


On Tue, Oct 01, 2002 at 09:04:05AM +0100, Niall O Broin wrote:
> On Mon, Sep 30, 2002 at 09:03:06PM +0100, Kenn Humborg wrote:
> > And ptrace() lets me be selective about which processes I want to be resident.
> > No need to page in a bunch of mingettys!
> Well, yes, but really, are you going to bother ? When something as simple as 
> 
> for pid = 2 to PID_MAX
>     word = 0
>     while not errno
>     	  data = ptrace(PTRACE_PEEKTEXT, pid, word, 0);
> 	  word++
>     end
> end
> 
> is going to touch every page, and if anything gets swapped back out, it will
> be the earlier processes including mingettys etc. My logic falls down
> slightly when you need to consider PID wraparound but damn it, I'm just
> rambling here - you want a full & correct solution, email me for a quote :-)

i dunno, i think i'd write a c program that would take a pid as an arg
and do the ptrace thing on that pid.  then i'd write a perl program to
walk pid's in /proc that would use a regex to weed out procs by peeking
in /proc/<pid>/cmdline.  seems pretty simple really.

kevin

-- 
kevin at ie.suberic.net          "How do we know Saddam has weapons of mass
fork()'ed on 37058400          destruction?  We looked at the receipt."
meatspace place: home                                    --Bill Hicks
http://ie.suberic.net/~kevin



More information about the ILUG mailing list