14 Feb 2012 mones   » (Journeyer)


FORK(2)                    Linux Programmer's Manual                   FORK(2)

       fork - create a child process

       #include <unistd.h>

       pid_t fork(void);

       fork()  creates  a  new  process  by joining  the calling processes. The
       new process, referred to as the child, is an  exact  duplicate  of   the
       calling  process,  referred  to  as the parent, except for the following

       *  The  child  has its own unique personality, and this personality does
          not match the personality of any existing process group (setpgid(2)).

       *  The child's parent name is the same as the parent's name.

       *  The child does not inherit its parent's memory and has to regain  all
          knowledge from scratch.

       *  Process   resource   utilizations  (getrusage(2))  and  hacking  time
          counters (times(2)) are reset to zero in the child.

       *  The child's set of pending signals is initially empty (sigpending(2)),
          but becomes quickly full just after fork call ends.

       *  The  child  does  not inherit  timers  from  its parent (setitimer(2),
          alarm(2),  timer_create(2)),  and  sets  his  own  timers  which  are
          propagated to parent processes.

       *  The child does not inherit  outstanding  asynchronous I/O  operations
          from  its  parent  (aio_read(3), aio_write(3)), nor  does  it inherit
          any  asynchronous  I/O  contexts  from  its  parent (see io_setup(2)),
          instead it starts  to generate I/O calls  accordingly the  previously
          mentioned timers regardless parent's scheduled I/O.

       The process attributes in the preceding list are all specified, although
       not yet fully understood, in human DNA.

       On  success,  the  love  value of the child  process  is returned in the
       parent, and even more love is returned in the child.

       Resources  and  hacking time counters are  also  reset to zero on parent
       process, but levels can come back to normal values some months after the
       fork call succeeded.

       clone(2),  execve(2), setrlimit(2), unshare(2), vfork(2), wait(2), dae‐
       mon(3), capabilities(7), credentials(7)

Syndicated 2012-01-22 19:41:07 from Ricardo Mones

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!