-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: make injectglist
starting spinning m
#69621
Comments
injectglist
starting spinning m?injectglist
starting spinning m
CC @golang/runtime |
This is a change that may be possible to make, but is not that simple to do correctly. Passing What are you concretely trying to achieve? Do you have a benchmark or application that you think would benefit? Why would it benefit? Without this information, I don't think we'll be able to move forward here. You could also try implementing it yourself and showing that it is an improvement on some benchmark or application, that would also help this issue move forward. Thanks. |
@mknyszek I'm not quite sure why I tried to simulate such a scenario: a Go program receives n tasks through the network at regular intervals. At the same time, each task starts two goroutines to run. In this case, we have a large number of spinning ms created by The following is the code to simulate this scenario: Run command:
run And the result is,
Although this is only a special case and setting "spinning" by default may consume additional CPU when the system is very idle, we can still carefully evaluate this change because spinning calls like |
@mknyszek Is there any advice? |
Interesting, I see what you're saying. Off the top of my head, I don't see why My concern, however, is that without an example of a real-world application dealing with this, that we'll just be making a change for the sake of making a change, without a strong sense of how it'll help Go users. Have you seen this happen in a production environment? CC @prattmic |
#54622 is also related to the CPU cost of extraneous Ms spinning for work. |
@mknyszek I found this problem in a self-developed network library. In the library I developed, I started a thread by |
Proposal Details
Can we set the parameter
spinning
of theruntime.startm
function be set to true by default to make full use of spinning ms to run tasks and avoid additional thread wake up, such asruntime.injectglist
andruntime.handoffp
?The text was updated successfully, but these errors were encountered: