Sorry, my machine has a cpu core of 8. I wrote the code this way because 
the main routine is also involved in the calculation. So there will be code 
like i = 1; i < Mcpu.
I considered the main routines when trying to control that the number of 
routines is not more than the number of cpu. This may be a little 
misunderstood, sorry about that.
在2021年2月2日星期二 UTC+8 下午12:18:08<Kurtis Rader> 写道:

> That is not what you told us, but perhaps there is a misunderstanding. In 
> your first message you said:
>
> > My machine has exactly 8 cpu's and I found that the runtime does not 
> decrease linearly when the number of go routines increases.
>
> Are you saying that the runtime does not decrease linearly when increasing 
> the number of goroutines from 1 to 8 (the number of cores on your system)? 
> Or when increasing the number of goroutines beyond 8?
>
> Also, your original code did `for i := 1; i < Mcpu; i++ {` which only 
> creates 7, not 8, goroutines. Is that intentional? It seems wrong given the 
> discussion to this point. Which raises additional questions about your 
> premise.
>
> On Mon, Feb 1, 2021 at 8:04 PM 颜文泽 <nnsm...@gmail.com> wrote:
>
>> But the number of my routines is smaller than the number of cpu
>>
>> 在2021年2月2日星期二 UTC+8 上午11:17:55<ren...@ix.netcom.com> 写道:
>>
>>> If you look at the “disrupter pattern” you’ll see what I mean. If the 
>>> tasks are cpu bound - by having more threads/routines than cpus you cause 
>>> inefficiencies (scheduling overhead, cache locality / invalidation, lock 
>>> contention). 
>>>
>>
> -- 
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/7e400bae-5d99-4c70-8c6b-260175c1619en%40googlegroups.com.

Reply via email to