But cleaning up processes can be ugly. Oh, man. If you don’t catch all your dead children you get zombie processes. And that’s not even the most gruesome mixed metaphor in Unix concurrency.
So: let’s look at a pattern in Ruby for using a single coordinator process with a separate process group to wrangle the child processes. Consider this a sort of extended fork/pipe example for spawning child workers, showing one way to set everything up. It’s a somewhat advanced pattern. Don’t be dismayed if you have to reread this or play with the code a bit before you get it right.