in reply to Re^6: Perl Thread Quitting Abnormally
in thread Perl Thread Quitting Abnormally

Your architecture means that your main thread is doing an awful lot of "busy work". Continuously looping around polling each of the threads to see if it has completed it current work item so that it can give it a new one. That means that when a given thread finishes one item it must then wait until the main thread gets around to checking its state and issue it with another host ip before it can continue doing anything useful.

That is not a good architecture. I suspect that your main thread will be consuming a substantial amount of your cpu resources basically doing the equivalent of the perpetually asking "Are we there yet? Are we there yet?".

A thread pool + queue architecture, such as I outlined in Re: How to create thread pool of ithreads would be more efficient and easier to reason about.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy