in reply to Dealing with multiple processes?
The way I would approach a problem like this one is to take inspiration from a fast food restaurant. One process has the role, “May I take your order, please?” This process takes your order and enqueues it for subsequent processing, but doesn’t do anything toward getting the work done. Meanwhile, a moderately-sized pool of processes are watching that queue, waiting for something to arrive and then performing their appointed role. (The “fry guy,” the “burger-meister,” the “liquids lady,” and so on. They do their job, but don’t interact directly with the customers.) There are foreground and background activities: you might get to mop the floor if nobody’s in the store, but with strict instructions to drop your mop and put on your fry-guy hat double quick if a tour-bus materializes in the parking lot.
It is possible for a bottleneck to appear, in which case the “manager on duty” can make appropriate adjustments in real-time, but the number of processes is never 1:1 linked to the number of orders that are being worked on. The workers may find themselves “100% busy,” but they are never overloaded. These principles map directly to computer software, and they work there just as well.
There are plenty of “thread-safe queues,” and even complete workload-management systems, e.g. POE, readily available in CPAN.