All the processes started from the same process share the same session and the same terminal. This is true when started with '&', run on the command-line, or fork/exec within a program.

When setsid() ("set session id") is called we create a new session which does not have a terminal. By default, the process which calls setsid() is moved to the new session (setsid() can take a PID as a parameter). The process is now the only process in the new session, unless it starts new processes itself. It does not have a terminal and ps -ef will show ? against its TTY column. This is the usual way that a daemon disconnects from a terminal since it does not want signals from the keyboard.

(Not copied from doc)

In reply to Re^4: Keep a "system" process running if script is prematurely exited? by cdarke
in thread Keep a "system" process running if script is prematurely exited? by westrock2000

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.