Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: use user-mode scheduling on Windows #7876

dvyukov opened this issue Apr 27, 2014 · 6 comments

runtime: use user-mode scheduling on Windows #7876

dvyukov opened this issue Apr 27, 2014 · 6 comments


Copy link

dvyukov commented Apr 27, 2014

Runtime could benefit from OS support for user-mode scheduling.
Namely, UMS on windows:
and switchto domains on linux:

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.
Copy link

minux commented Apr 27, 2014

Comment 1:

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?

Copy link
Member Author

dvyukov commented Apr 28, 2014

Comment 2:

You are correct.
To prevent deadlocks scheduler can still create new threads to run Go, but much more
lazily (so that it mostly does not happen for normal programs).

Copy link

gopherbot commented Mar 18, 2016

CL mentions this issue.

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-by: Austin Clements <>
Run-TryBot: Dmitry Vyukov <>
TryBot-Result: Gobot Gobot <>
Reviewed-by: Alex Brainman <>
Copy link

zx2c4 commented Nov 27, 2020

I'm wondering if there's still interest in doing this, given the evolution of the runtime in the last 6 years. At cursory glance, it looks appealing.

Copy link

networkimprov commented Nov 27, 2020

Copy link

ianlancetaylor commented Nov 28, 2020

According to #8687 (comment) User Mode Scheduling is considered to be deprecated, and will not be supported on ARM platforms.

So I suspect we should just close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

8 participants