Maximum number of threads

Alex via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 24 15:58:28 PDT 2015


On Thursday, 24 September 2015 at 12:38:41 UTC, Temtaime wrote:
> Offtop: i think if number of threads > number of real cores, 
> than there's something wrong with your design. Maybe fibers 
> suit better ?

Well... you got my idea :) So it is not so far offtop, as you 
think )))
Fibers DO suit better as an idea of light workers. But the 
problem I have to manage is, that my program has to incorporate 
unpredictability in the work cycle of my workers. It is one of 
the main idea of the process itself. So the fact that a fiber 
yields at fixed points of his work is just the opposite from what 
I want.

But the portability of code is an issue too... and my tries show, 
that I can't rely on this with threads...

Having said that, I got an idea today, how I could try to 
incorporate fibers for my needs. If I manage to hide the yields 
calls of my workers in some random environment, I could express, 
that a worker can but must not give up his control at a specific 
point of his work. I have to try this idea next days.
Using fibers instead of threads would save me from a lot of 
troubles anyway... ;)

Thanks to everybody for hints about my question!


More information about the Digitalmars-d-learn mailing list