Cari di Perl 
    Perl User Manual
Daftar Isi
(Sebelumnya) Abandon this program to run anotherGet process group (Berikutnya)
Functions for processes and process groups

Create a new process just like this one

Daftar Isi

  • fork

    Does a fork(2) system call to create a new process running thesame program at the same point. It returns the child pid to theparent process, 0 to the child process, or undef if the fork isunsuccessful. File descriptors (and sometimes locks on those descriptors)are shared, while everything else is copied. On most systems supportingfork(), great care has gone into making it extremely efficient (forexample, using copy-on-write technology on data pages), making it thedominant paradigm for multitasking over the last few decades.

    Beginning with v5.6.0, Perl attempts to flush all files opened foroutput before forking the child process, but this may not be supportedon some platforms (see perlport). To be safe, you may need to set$| ($AUTOFLUSH in English) or call the autoflush() method ofIO::Handle on any open handles to avoid duplicate output.

    If you fork without ever waiting on your children, you willaccumulate zombies. On some systems, you can avoid this by setting$SIG{CHLD} to "IGNORE". See also perlipc for more examples offorking and reaping moribund children.

    Note that if your forked child inherits system file descriptors likeSTDIN and STDOUT that are actually connected by a pipe or socket, evenif you exit, then the remote server (such as, say, a CGI script or abackgrounded job launched from a remote shell) won't think you're done.You should reopen those to /dev/null if it's any issue.

    On some platforms such as Windows, where the fork() system call is not available,Perl can be built to emulate fork() in the Perl interpreter.The emulation is designed, at the level of the Perl program,to be as compatible as possible with the "Unix" fork().However it has limitations that have to be considered in code intended to be portable.See perlfork for more details.

    Portability issues: fork in perlport.

 
Source : perldoc.perl.org - Official documentation for the Perl programming language
Site maintained by Jon Allen (JJ)     See the project page for more details
Documentation maintained by the Perl 5 Porters
(Sebelumnya) Abandon this program to run anotherGet process group (Berikutnya)