Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Fork Results in thousands of processes

by marto (Cardinal)
on Nov 28, 2011 at 11:12 UTC ( [id://940351]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Fork Results in thousands of processes
in thread Fork Results in thousands of processes

As I mentioned earlier, please don't ignore the formatting advice when posting. Please read and understand How do I post a question effectively?.

  • Comment on Re^3: Fork Results in thousands of processes

Replies are listed 'Best First'.
Re^4: Fork Results in thousands of processes
by anshumangoyal (Scribe) on Nov 28, 2011 at 11:29 UTC
    Sorry here is the correct code: But now my parent process dies when i use:
    exec('touch', $callCount); die $!;
    in child process. Here is the code:
    while ($callCount <= $totalCalls) { for (1..$callPerSec) { printf "Call -> callCount"; my $pid = fork(); if($pid) { #in Parent Process printf " :: PID -> $pid\n"; push(@list_of_pid, $pid); } elsif($pid == 0){ #in Child Process exec ('touch', $callCount); die $!; } else { printf "Resource Not available\n"; } $callCount++; } print "Total Calls Executed $callCount\n";
      You never wait for the children to end. See wait, waitpid

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://940351]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (8)
As of 2024-04-23 12:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found