Grokking concurrency, message passing and Co

div0 div0 at users.sourceforge.net
Sun Jul 11 14:29:54 PDT 2010


On 11/07/2010 21:43, BCS wrote:
> Hello div0,
>
>> On 11/07/2010 20:00, BCS wrote:
>>
>>> Hello div0,
>>>
>>>> The rule of thumb is don't bother spawning more threads than you
>>>> have cpus. You're just wasting resources mostly.
>>>>
>>> You REALLY don't want more threads trying to run than you have cores.
>>> Threads in a wait state, are less of an issue, but they still use up
>>> resources.
>>>
>> I think you're going a bit far there.
>
> In what way?

Sometimes it just makes your program design easier if you fork a process 
/ spawn a thread; than trying to manage a thread pool and allocating 
work to a fixed number of threads. Programmer time is more expensive 
than cpu time and it depends who's paying the bill.

(hmm, haven't you said that before?)

> And In re-reading my post, I noticed it can be read it two ways. The way
> I intended it, is as a "yes and" statement: while often there is little
> to be gained by having more threads than cpus/cores, there is almost
> always nothing to be gained by having more thread trying to do stuff at
> the same time than you have cpus/cores to run them on.
>

Personally I'd never use more threads than cores as a program design, 
but I'm a performance whore. ;)

-- 
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk


More information about the Digitalmars-d-learn mailing list