runtime: use user-mode scheduling on Windows #7876
Runtime could benefit from OS support for user-mode scheduling. Namely, UMS on windows: http://msdn.microsoft.com/en-us/library/windows/desktop/dd627187(v=vs.85).aspx and switchto domains on linux: http://www.youtube.com/watch?v=KXuZi9aeGTw This would allow to determine when a thread in syscall/cgocall actually block. Which would allow to reduce non-blocking syscall/cgocall overhead by delaying most of the work till the actual blocking; and to prevent CPU oversubscription by maintaing total of GOMAXPROCS threads running both Go and C/syscall code. The obvious downside is increased complexity and lots of OS-specific code.
maintaining total GOMAXPROCS threading running both go and cgo code will break at least one misc/cgo/test case though. However, if we count goroutines running cgo code towards to GOMAXPROCS, then I think we can dramatically reduce cgocall overhead (no scheduler coordination except mark that it enters cgocall). Am I correct?
gopherbot pushed a commit that referenced this issue
Apr 9, 2016
This reverts commit ab4c929. Sysmon critically depends on system timer resolution for retaking of Ps blocked in system calls. See #14790 for an example of a program where execution time goes from 2ms to 30ms if timeBeginPeriod(1) is not used. We can remove timeBeginPeriod(1) when we support UMS (#7876). Update #14790 Change-Id: I362b56154359b2c52d47f9f2468fe012b481cf6d Reviewed-on: https://go-review.googlesource.com/20834 Reviewed-by: Austin Clements <email@example.com> Run-TryBot: Dmitry Vyukov <firstname.lastname@example.org> TryBot-Result: Gobot Gobot <email@example.com> Reviewed-by: Alex Brainman <firstname.lastname@example.org>