#!/usr/local/bin/perl use strict; use warnings; print “Starting main program\n”; my @childs; for ( my $count = 1; $count <= 10; $count++) { my $pid = fork(); if ($pid) { # parent #print “pid is $pid, parent $$\n”; push(@childs, $pid); } elsif ($pid == 0) { # child sub1($count); exit 0; } else […]
<? print “Starting main program\n”; $childs = array(); for ( $count = 1; $count <= 10; $count++) { $pid = pcntl_fork(); if ( $pid == -1 ) { // Fork failed echo “Fork failed\n”; exit(1); } else if ( $pid ) { # parent #print “pid is $pid, parent $$\n”; array_push($childs, $pid); } […]
Mr. Peabody Explains fork() Introduction How Windows Does It How Unix Does It So Why Do People Want the Unix Way? How does it work in Perl? Introduction UNIX – Fork Explained Say, Mr Peabody. I was just reading through the Perl 5.6 release notes and noticed that a new function called fork() is now […]