#!/usr/bin/perl -w # # example of process which forks into two # # Split into two processes. # In the parent, $pid = process id of the child. # In the child, $pid = 0. my $pid = fork; die " ** ERROR ** couldn't fork : $!" unless defined($pid); if ($pid) { print " parent: child pid = $pid \n"; print " parent: My process ID = $$ \n"; } else { print " child: I wonder who my mommy is... \n"; print " child: My process ID = $$ \n"; print " child: exiting.\n"; exit; } waitpid($pid, 0); print " parent: past waitpid. (My process ID is still = $$ ) \n"; # Note: to show all "msie" running processes, do this # from the shell prompt: ps -aef | grep msie