in reply to Re^6: threads on Windows
in thread threads on Windows
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: threads on Windows
by kennethk (Abbot) on Feb 18, 2009 at 16:38 UTC | |
by BrowserUk (Patriarch) on Feb 19, 2009 at 04:34 UTC | |
by kennethk (Abbot) on Feb 19, 2009 at 14:38 UTC |