3 ms·
In the future some Go programs may fail or perform really badly (not exit for minutes) with GOMAXPROCS=1. Since Go isn't preemptively scheduled if you have a g
by bsdetector 11y ago
In the future some Go programs may fail or perform really badly (not exit for minutes) with GOMAXPROCS=1. Since Go isn't preemptively scheduled if you have a goroutine in a long-running or busy loop the program will run normally using 2 CPUs and freeze with 1. Even well-written programs can become "chunky" with 1 CPU and exhibit huge latency spikes not seen with 2 CPUs. Because of M:N threading.
- pcwalton 11y agoIt's sort of preemptively scheduled on function call boundaries now, isn't it?
- bsdetector 11y agoThere was preemption in some places. I thought it was when the stack grew or shrank, but who knows. Checking at every function call seems like a huge waste. This probably won't cause anywhere near as many problems as >1 CPU, but still since VMs sometimes have 1 CPU and almost no developer computers have 1 CPU I expect it will not be unheard of.