On 01/04/2010 11:52 AM, I=F1aki Baz Castillo wrote:
> Hi, I know that a Ruby process with PID 1000 (under Linux) has forked 4=
 times.=20
> How could I know the PID of those childs from any other ruby interprete=
r?
> This is, I just know the PID of the parent (1000).
>=20
> Of course I could do some hack as inspecting the output of "ps" and ins=
pecting=20
> the pid/ppid, but I'd prfer a ppure Ruby method for this.
>=20
> Thanks for any suggestion.

The typical approach is that the forking parent records PIDs of its=20
children.  If that information needs to be propagated you can either=20
write it to a file or make it available via DRb.

If you need multiple Ruby processes to collaborate I would probably turn =

to DRb anyway.  In that case you might not even need to record PIDs but=20
you could have a coordinator where processes register and unregister or=20
which starts processes itself.  It depends on your use case.

Kind regards

	robert

--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/