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: selectgo need not lock all the channels involved in the select #41948

Open
dreamerjackson opened this issue Oct 13, 2020 · 3 comments
Open
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Performance
Milestone

Comments

@dreamerjackson
Copy link
Contributor

i read the select function:

func selectgo(cas0 *scase, order0 *uint16, ncases int) (int, bool) {
   ...
	// lock all the channels involved in the select
	sellock(scases, lockorder)

}

why we should lock all the channels?
i think lock one by one when loop may be better , because it will quickly

@randall77
Copy link
Contributor

Dmitry tried this a while ago: https://go-review.googlesource.com/c/go/+/7570
TL; DR it is tricky to get right. We never convinced ourselves it was correct.

@dreamerjackson
Copy link
Contributor Author

Dmitry tried this a while ago: https://go-review.googlesource.com/c/go/+/7570
TL; DR it is tricky to get right. We never convinced ourselves it was correct.

most case it may will work ok,but select is one of the most important role in go, when channel in select increase and Concurrent oparate the channels, the performance will down.

@toothrot toothrot added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 15, 2020
@navytux
Copy link
Contributor

navytux commented Dec 18, 2020

See also: #8896

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 7, 2022
@seankhliao seankhliao added this to the Unplanned milestone Aug 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Performance
Projects
Status: Triage Backlog
Development

No branches or pull requests

6 participants