Although a goroutine isn’t pre-emptible by the Go scheduler, there is an
opportunity whenever it does something which blocks or when it calls a
non-inlined function. So generally the GC’s STW can take place pretty quickly.
But if you are doing something with is totally compute bound then it can be a
problem. An easy solution is to insert a call to runtime.Gosched() every so
often.
I believe that there is an ongoing discussion about a way for Go to plan ahead
and be able to handle even these cases, but it’s something for the future.
John
John Souvestre - New Orleans LA
From: [email protected] [mailto:[email protected]] On
Behalf Of ???
Sent: 2017 September 04, Mon 00:47
To: golang-nuts
Subject: [go-nuts] golang gc stop the world how to stop cpu busy goroutine?
when have one or two cpu busy goroutine in my server (example for loop empty),
the gc stop the world how to stop the goroutine ?
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.