It's still not clear to me what benefit you think you are getting from passing the inputs to another thread to be actioned?

I don't yet have a multi-core machine to test my hypothysis, but I strongly suspect that even if your minister thread is currently running on a another core when you read and post the input to the queue, that it probably takes an order of magnitude longer for the code to get actioned than if you did it inline within the read loop.

If you are wedded to your "king's don't do things for themselves" analogy, then just call your minister subroutine directly, rather messing around with an extra thread and queue.

I don't doubt it will work okay your way, I just don't see any benefit coming from the extra complexity and the performance hit it entails?

I'm also unconvinced about the need for semaphores and signals in your workers. I see what your doing with them, and that it works, but still the question remains: why? Why do you need to pause/resume/kill threads?

So far, the whole exercise seems to be a case of: "There are these modules kicking around, I wonder what I can do with them."; rather than: "I have this problem to solve, how can I best achieve that.". Ie. You seem to be trying to develop and infrastructure to cater to some supposed possible requirements, rather trying to code a solution to a specific problem.

In every case where I've seen a framework developed in the absence of a real and well specified requirement, the framework has ended up being overengineered, inefficient and a nightmare to use for real applications, because it was built to satisfy some theoretical design goal rather than real application requirements.

For example: Kings rarely instruct ministers; rather they simply endorse the proposals put forward by ministers. And kings certainly don't answer there own phones--or whatever anology you use for STDIN. And shouldn't you have a few secretaries around to do the donkey work?

I really don't think that I can be of any further help to you until you describe the actual requirements of your real application, rather than some badly fitting analogy.


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.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re^7: threads on Windows by BrowserUk
in thread threads on Windows by kennethk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.