On Wed, Nov 26, 2008 at 4:21 PM, Jeff Pang <[EMAIL PROTECTED]> wrote:

> > Message du 26/11/08 16:13
> > De : "Sharan Basappa"
> > A : "Perl Beginners"
> > Copie à :
> > Objet : system command
> >
> >
> > Hi,
> >
> > I am trying to launch a program using system command.
> > The program usually takes 20-30 minutes to complete.
> > I launch the programs in a loop.
> > Will the system command wait for first program to complete and then
> proceed
> > to the next one.
> > What if I want to launch these programs in parallel which is not
> > possible if system command waits for
> > the first program to complete before proceeding to next one.
> >
>
>
> Could use a fork.
>
> while( ... ) {
>
>     unless (fork) {
>         system(...); # in child
>          exit 0;
>     }
> }
>
> see perldoc -f fork.
>
>
> --
> Jeff Pang
> http://home.arcor.de/pangj/
>
>  Créez votre adresse électronique [EMAIL PROTECTED]
>  1 Go d'espace de stockage, anti-spam et anti-virus intégrés.
>


Or you might want to use threads, though they are certainly not the same
both have their advantages and you might want to read up on them before
making a decission on which to use.

In any case I would advise you to first, use which ever way of modeling you
prefer, to draw out the way the system works and to identify exactly which
processes depend on which other processes. Due to the way OS's handle
multiple seperate processes paying special attention to how the seperate
independent parts run and how that might affect the main program or other
independent parts becomes quite important. You need to count on some
processes failing, not finshing as fast as you would normally expect because
there are now more processes running at the same time and things like file
locking if the independent parts are operating on the same files... all in
all making a quick drawing even of a very simple program can prevent a lot
of trouble later on.

Reply via email to