Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Launching numerous instances of the same program

by Terrabyte (Initiate)
on Jan 11, 2001 at 01:51 UTC ( #50990=perlquestion: print w/replies, xml ) Need Help??

Terrabyte has asked for the wisdom of the Perl Monks concerning the following question:

How can I launch many instances of the same program from within a perl script. An example would be starting 10 instances of calc on the Win32 platform. When I use system, it waits for a response. When I use exec, it shifts to calc. If I fork, I just start myself again. Help!!!!

Originally posted as a Categorized Question.

  • Comment on Launching numerous instances of the same program

Replies are listed 'Best First'.
Re: Launching numerous instances of the same program
by extremely (Priest) on Jan 11, 2001 at 02:11 UTC
    Fork 10 children and exec calc in the children. Also, FYI a fork in a loop is called a fork-bomb. Make sure you know exactly how your loop works so that you don't consume all the allowed resources under your OS and kill the box. I've personally seen a 1/4 million dollar machine rebooted more than once over other goofballs doing this. People loose root access, their jobs, or get the FBI called on them for tricks of this sort. =)
Re: Launching numerous instances of the same program
by repson (Chaplain) on Jan 11, 2001 at 07:55 UTC
    On a win32 system you will want create processes with Win32::Process in a loop. A fork and exec will not work in windows.
Re: Launching numerous instances of the same program
by turnstep (Parson) on Jan 11, 2001 at 03:10 UTC

    Don't expect fork to work very well under Win32 either...see the thread fork on Win32

Re: Launching numerous instances of the same program
by jplindstrom (Monsignor) on Jan 12, 2001 at 02:42 UTC
    I personally like Win32::Process, but another way of doing this (the Windows way of starting things with &) is to use the "start" command.

    Type "start /?" at the command line to get the options.

    /J

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2021-04-19 10:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?