Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Yet another spawn question. Portable method?

by LanX (Saint)
on Sep 16, 2017 at 13:28 UTC ( [id://1199513]=note: print w/replies, xml ) Need Help??


in reply to Yet another spawn question. Portable method?

Welcome to the monastery

What is the question?

update

From the comments inside the code, it seems you're asking how to fork in an OS agnostic way.

On a side note:

With this chain strategy you are risking to run unlimited numbers of jobs in parallel .

Having one master controlling all slaves would give you better control.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

Replies are listed 'Best First'.
Re^2: Yet another spawn question. Portable method?
by MickeyLane (Initiate) on Sep 16, 2017 at 15:20 UTC

    My apologies for the missing question - updated.

    As for the chain, each time a script is started, an integer is passed as an arg that indicates how many times the script can be spawned. Each spawn decrements the int. "perl spawn.pl 3" will cause 3 instances of the script to be spawned:

    D:\Views Tests>perl spawn.pl 3 Starting PID 3616 as instance 3 Starting PID 5940 as instance 2 Starting PID 6064 as instance 1 PID 3616 ended D:\Views Tests>Starting PID 4564 as instance 0 PID 5940 ended PID 6064 ended PID 4564 ended
      > Each spawn decrements the int.

      Still, you are unnecessarily giving up control, like the possibility to kill the master and all children at the same time.

      see also perlipc

      This is not my field of expertise, but IMHO your requirement not to use extra modules will make this a rather complicated task.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-03-29 12:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found