> > Wiggins d Anconia wrote: > > >It's dangerous to make blanket statements like this. Each is a tool that > >should be understood and applied in the right manner. > > > I agree with this. Generally system would be the right fit for many of > my Perl programs. However exec has it's place like any tool. > > >That is why it is > >more important to understand the concepts of process execution, > >parallelism, blocking, etc. rather than any one particular function. > >'system' is really just a combination of a fork+exec+waitpid model that > >is easy to use, the backticks are similar to the open pipe model, but > >generally easier to use as well, the open pipe model is really just a > >fancy version of the same fork+exec+waitpid model. So some would claim > >you should use fork+exec+waitpid, because 'system' really just uses > >them, others would say that is the beauty of Perl, 'system' provides a > >very good shortcut, assuming it accomplishes the goal. > > > hmm... So system could generate zombie processes? Or a filehandle > process? > > I guess it really depends on what we are kicking off and whether it > exists cleanly. > >
Theoretically any process that starts a subprocess can result in the creation of zombies. 'system' *should* be protected from this (read: I don't really know because I am definitely not an internals expert) because of either how waitpid is written or because it can temporarily adjust the CHLD sig handler. I am unclear about exactly how this stuff works, again not an internals person. Essentially you are correct, though the important part is how the parent exits, not the child. zombies are created when the parent exits before all of its children (at least those that are not auto reaped), essentially no process is then 'waiting' for them. I suspect the thinking is that if you know enough of how to create sub processes, then you should know enough of how to deal with them correctly, aka reading exit codes, doing IPC, waiting for them to clean up, etc. Not having to know all of this yourself, is why 'system', backticks, piped opens, and POE are so nice. Just for the archives, I have never had a problem of zombies being left over by a program calling either 'system' or a piped open. (The problem only seems to present itself when I write my own forking code ;-)). http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>