Unix Programming - How do I know if a process is being blocked?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > September 2007 > How do I know if a process is being blocked?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How do I know if a process is being blocked?
K-mart Cashier

2007-09-12, 1:18 am

This is a cross over from comp.lang.ruby



The getty is a daeamon

When I do soemthing like

#!/usr/local/bin/ruby

threads=[]

4.times do |i|
threads[i]=Thread.new do
%x{/usr/libexec/getty std.19200 tty00}
end
end
threads.each{|thr| thr.join}

I see the following
-bash-3.2$ ps -j
cd 1877 10367 1877 d6bd16c0 1 I ph 0:00.01
/usr/local/bin/rub
cd 29342 1877 1877 d6bd16c0 1 I ph 0:00.00
/usr/libexec/getty
cd 2773 1877 1877 d6bd16c0 1 I ph 0:00.00 /usr/libexec/
getty
cd 30538 1877 1877 d6bd16c0 1 I ph 0:00.01
/usr/libexec/getty
cd 6442 1877 1877 d6bd16c0 1 I ph 0:00.01
/usr/libexec/getty

Each thread is creating a new process.

However, when I change to the same code to a program that isnt a unix
daemon

like

#!/usr/local/bin/ruby

threads=[]

4.times do |i|
threads[i]=Thread.new do
%x{/usr/local/bin/party
}
end
end
threads.each{|thr| thr.join}

I see the following
-bash-3.2$ ps -j
cd 29735 15232 29735 d6bd1d80 0 Is+ ph 0:00.06 -bash (bash)
cd 12524 29735 12524 d6bd1d80 1 T ph 0:00.02
/usr/local/bin/rub


In this case, the thread isn't creating a process. Is getty blocking
since it's been forked 4 times, but is sleeping?

David Schwartz

2007-09-12, 7:20 pm

On Sep 11, 8:01 pm, K-mart Cashier <cdal...@gmail.com> wrote:

> In this case, the thread isn't creating a process.


How did you establish that? Just because the process isn't running now
doesn't mean it wasn't created.

> Is getty blocking
> since it's been forked 4 times, but is sleeping?


Huh? What do you mean by "blocking"?

DS

K-mart Cashier

2007-09-13, 1:19 am

On Sep 12, 12:44 pm, David Schwartz <dav...@webmaster.com> wrote:
> On Sep 11, 8:01 pm, K-mart Cashier <cdal...@gmail.com> wrote:
>
>
> How did you establish that? Just because the process isn't running now
> doesn't mean it wasn't created.
>
>
> Huh? What do you mean by "blocking"?
>
> DS



I ran party and saw the following

-bash-3.2$ ps -j
USER PID PPID PGID SESS JOBC STAT TT TIME COMMAND
cd 28246 5443 28246 e978d8a4 0 Is+ pG 0:00.02 -bash (bash)

It shows the bash prompt, but not party. Now when I grep party, I see
the following

-bash-3.2$ ps waux | grep party
party 55 0.0 0.2 568 996 pG S+ 8:21PM 0:00.10 /usr/
local/bin/party_ (party)


Is this some kind of fork?

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com