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).
> On Feb 1, 2021, at 9:02 PM, 颜文泽 <nnsmgs...@gmail.com> wrote: > > > I don't understand what you mean. > 在2021年2月2日星期二 UTC+8 上午10:56:41<ren...@ix.netcom.com> 写道: >> Having more cpu bound routines than you have physical cpus is not a good >> idea. >> >>>> On Feb 1, 2021, at 8:21 PM, 颜文泽 <nnsm...@gmail.com> wrote: >>>> >>> I'll try 1.14, when writing cpu-intensive programs (I'm mainly a >>> database), I found that cache misses from routines switching is also a >>> headache and I don't know how to deal with it. >> >>> >>> >>> 在2021年2月2日星期二 UTC+8 上午8:10:12<Ian Lance Taylor> 写道: >>>> On Mon, Feb 1, 2021 at 4:07 PM Wojciech S. Czarnecki <oh...@fairbe.org> >>>> wrote: >>>> > >>>> > Dnia 2021-02-01, o godz. 11:12:22 >>>> > Ian Lance Taylor <ia...@golang.org> napisał(a): >>>> > >>>> > > On Mon, Feb 1, 2021 at 9:33 AM 颜文泽 <nnsm...@gmail.com> wrote: >>>> > >>>> > > > go version go1.13 linux/amd64 >>>> > >>>> > > Goroutines that run for a long time without yielding the processor are >>>> > > preempted. >>>> > >>>> > Since go1.14 TMK. OP is using 1.13. >>>> >>>> In Go 1.14 and later they are preempted by signals. Before Go 1.14 >>>> they were still preempted, it just happened when making a function >>>> call (which meant that the preemption could be arbitrarily delayed). >>>> >>>> Ian >>> >> >>> -- >>> 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...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/golang-nuts/26178bb4-9f60-4fd4-bf3a-9c170e18152bn%40googlegroups.com. > > -- > 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/22d5d008-a3f9-4296-92ba-7306660cad71n%40googlegroups.com. -- 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/23D6F9BC-D7A4-4151-A382-8A913FA70393%40ix.netcom.com.