Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
When you are running a normal program from the shell, it can return back an exit status back to the shell when it quits, exit(12), etc. The same sort of thing can happen when a child process exits. The parent gets a SIGCHLD when the child dies and it can go look at the child's exit status if it wants to.

The child's entry remains in the process table as a place to maintain this status. A child in this state is sometimes called a "zombie" and the process of reading the status is called "reaping" the child. There is an option in waitpid to get the exit status, but in practice most common is to just throw it away (parent doesn't care). So that is what SIGCHLD is about. If you don't care (a) that the child died or (b) what its exit status was, then you can ignore the SIGCHLD signal and the OS will throw the exit status away for you without the parent having to do that.

This behavior is of course OS specific - most portable thing is to explicitly say what you want to have happen (either by installing your signal handler or setting it to "ignore". So if the parent doesn't care about (a) or (b), then there is nothing wrong with having the status "auto-reaped" and discarded.

In reply to Re: Monitoring child processes by Marshall
in thread Monitoring child processes by rovf

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2022-05-19 16:00 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (71 votes). Check out past polls.