[go-nuts] Re: How long does a goroutine could run successively before being preempted? 10ms or 20ms?

2022-03-03 Thread Hans Allen
Just for curiosity, why 10ms? Author told a answer. See https://go-review.googlesource.com/c/go/+/8838/. On Wednesday, March 2, 2022 at 11:46:20 PM UTC+8 Hans Allen wrote: > > It seems 10ms. > > Introduced originally in go1.2 > See https://codereview.appspot.com/10796043

[go-nuts] Re: How long does a goroutine could run successively before being preempted? 10ms or 20ms?

2022-03-02 Thread Hans Allen
It seems 10ms. Introduced originally in go1.2 See https://codereview.appspot.com/10796043. On Monday, February 28, 2022 at 9:10:06 PM UTC+8 Hans Allen wrote: > > Since go1.14, cpu busy goroutine will not occupy a P indefinitely any > more. This is done by a cool feature: async

[go-nuts] Re: How long does a goroutine could run successively before being preempted? 10ms or 20ms?

2022-03-02 Thread Hans Allen
It seems 10ms. Introduced originally in go1.2. See https://codereview.appspot.com/10796043. On Monday, February 28, 2022 at 9:10:06 PM UTC+8 Hans Allen wrote: > > Since go1.14, cpu busy goroutine will not occupy a P indefinitely any > more. This is done by a cool feature: async

[go-nuts] How long does a goroutine could run successively before being preempted? 10ms or 20ms?

2022-02-28 Thread Hans Allen
Since go1.14, cpu busy goroutine will not occupy a P indefinitely any more. This is done by a cool feature: asynchronously preemption. There is one extra NoP thread(sysmon) runs time to time. It checks if current goroutine has run 10+ms. If so, signal the M runs this goroutine to switch to a