On Mon, 2008-11-03 at 17:01 -0800, ron minnich wrote:
> On Sun, Nov 2, 2008 at 9:55 PM, Roman Shaposhnik <[EMAIL PROTECTED]> wrote:
> > when somebody tries to stop a process that is waiting for the IO the process
> > doesn't get transferred to a Stopped state immediately but only when
> > the scheduler sees it for the first time. This leads to a process writing to
> > a /proc/n/ctl being put in a Stopwait state which is a bit inconvenient.
> >
> > Is there any way I can poke the target process so that it gets attention
> > from the scheduler an can be put in a Stopped state?
> >
> 
> Hi Roman, what's the bigger picture here? I am trying to understand
> ... sorry if I'm missing the obvious.

I'm glad you've asked ;-) In fact, there's a bigger context and it is
around managing processes run by cpu(1) from the terminal host. I was
planning on writing an email on that subject to this list over the
weekend but I need to amass some level of intelligence in that area
first. 

For now, though, the easiest way to illustrate my problem would be to
imagine a situation where you want to write some data into a Data
segment of the process that is waiting for the IO. Now, waiting for 
the IO is almost as good as state as Stopped (the process is stuck in
kernel waiting to be put back on the runqueue) so one would expect the
transition between these 2 states to be almost trivial. Literally, all
I'm asking is -- "dear kernel, please don't advance this process even
if you otherwise can". All I need is a frozen state so that I can
manipulate some data. Yet, I can't figure out how to do that:
  term% ps | grep 310
  glenda          310    0:00   0:00       24K Pread  cat

  term% cat /proc/310/seg*  
  Stack     0f000000 10000000    0
  Text   R  00001000 00006000    0
  Data      00006000 00007000    0
  Bss       00007000 00007000    0

  term% dd -if /dev/zero -bs 1 -count 1 -of /proc/310/mem -seek 6100
  write: bad process or channel control request
  1+0 records in
  0+0 records out

Of course, the process is Spleeping, so we need to stop it:

  term% echo stop > /proc/310/ctl

This hangs, so I'll provide some input to 'cat' so that it becomes
Stopped and I can do:
  term% dd -if /dev/zero -bs 1 -count 1 -of /proc/310/mem -seek 6100
  1+0 records in
  1+0 records out

But! I'm really stuck if I can't give that input to something
that is Pread.

How are debugging/analysis tools supposed to deal with a situation
like that? I would imagine this to be a pretty common situation 
for them, right?

Thanks,
Roman.


Reply via email to