Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: fork always 'n' processes.

by Anonymous Monk
on Mar 20, 2018 at 15:25 UTC ( [id://1211346]=note: print w/replies, xml ) Need Help??


in reply to fork always 'n' processes.

I do not readily see the advantage of using forks especially on the client side and especially since the server is handling requests one at a time. The client is always going to be stuck in a rather long I/O wait for the server to respond, and you simply need to throttle how many requests the client sends out at one time. (Each time a reply arrives, it can simply check a counter and submit a new request.)

Replies are listed 'Best First'.
Re^2: fork always 'n' processes.
by Anonymous Monk on Mar 20, 2018 at 16:48 UTC
    Thanks for answering. 1. I have a queue of tasks, a socket is giving me; 2. I would like to process these tasks 'n' processes at a time; 3. Always 'n' processes should be active and running; 4. Until the end of the queue has been reached. I am thinking of a 'scalable' way and use more clients to process the tasks queue. TheMagician

      Have you looked at Parallel::ForkManager?

      Edit: changed title because "always 'n' processes" reads too much like "Guns 'n' Roses" or "fish 'n' chips" to me.

      You should elaborate on your requirements. Is this intended to be portable? Windows/linux? Do you need it as perl code? There are utilities that can help in running parallel tasks (e.g. xargs). Do you need those jobs as separate processes; perhaps a threaded version might suit you as well?

      Have you searched for modules (e.g. Parallel::ForkManager)? Do you actually need a robust, efficient solution or is this homework?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-03-29 05:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found