in reply to A per-instance shared queue among forked child processes?

Have you considered using threads instead of forks? Thread::Queue is pretty nice. If memory usage of the queue really is an issue, you can refer to files / db rows / ...
  • Comment on Re: A per-instance shared queue among forked child processes?

Replies are listed 'Best First'.
Re^2: A per-instance shared queue among forked child processes?
by EvanK (Chaplain) on Apr 07, 2011 at 20:40 UTC
    I was using threads in my original version of the script, but ran into several issues:
    • Starting new threads seemed to be much heavier in resource usage than starting new forks (and I'm forking on demand several times within a main event loop)
    • Worker threads were getting seemingly random SIGALRM signals, which ended up bombing out the entire process with an "Alarm Clock" message
    • I couldn't find a definitive answer on whether many of the modules I'm using are threadsafe.
    • Quite frankly, I understand forking much better on a conceptual level than ithreads
    So I ended up rewriting it with forks and it seems much more stable this way.