[RFC] rcexecr: rcorder in parallel
jilles at stack.nl
Sat Jun 4 12:27:05 UTC 2011
On Sat, Jun 04, 2011 at 12:45:37PM +0100, Julien Laffaye wrote:
> On Sat, Jun 4, 2011 at 10:10 AM, Buganini <buganini at gmail.com> wrote:
> > https://github.com/buganini/rcexecr
> > Currently it is able to determine the exec/wait order
> > There are something I haven't digged in deeply in the "self
> > modification" part.
> > patches/ideas are welcome.
> Thanks for doing that!
> You should use kqueue(2) instead of waitpid(2) so that you can
> efficiently monitor a pool of processes.
> See pwait(1) for an example.
Hmm, I don't think kqueue() should be used here. Its main advantage is
that it works regardless of parent-child relationships, but that
advantage is not relevant here. On the other hand, waitpid() is still
necessary to get rid of the zombies. Furthermore, waitpid() is standard
while kqueue() is not, and I think non-standard interfaces should only
be used if they provide a real benefit above standard interfaces.
The current approach with waitpid() for specific processes should be
good enough for a proof of concept. It will keep zombies longer than
necessary, particularly for things that are not explicitly depended on.
To avoid this, use waitpid(-1, ...) and maintain more tracking for
processes that have already terminated.
More information about the freebsd-current