Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
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?