Hi All,

In my script, i am trying to call multiple fork call.

if i call less than 10 times, its working fine.

If i call more than 20 or 30 times, most of the process getting time out or died

foreach my $ttyport (@processTTY)

    my $pid = fork();Inline Code Example Here



Can somebody suggest the solution for this issue?


consider this fragment:
Youll see that the $ttyport is not a global variable,
each fork call gets its own copy, so its gonna loop more than


use POSIX;

for($i = 0; $i < 10; $i++){

  $pid = fork();

   $ppid = getppid();
   print "$ppid\n" unless $ppid == 1;

This article has been dead for over six months. Start a new discussion instead.