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

consider pulling long running threatpool threads from the pool #105165

Open
danmoseley opened this issue Jul 19, 2024 · 2 comments
Open

consider pulling long running threatpool threads from the pool #105165

danmoseley opened this issue Jul 19, 2024 · 2 comments

Comments

@danmoseley
Copy link
Member

danmoseley commented Jul 19, 2024

Work scheduled with TaskCreationOptions.LongRunning currently always creates a new thread. If the threadpool is sufficiently idle then it might be worthwhile to grab an idle threadpool thread to use instead - and kick off creating a replacement one to put in the threadpool.

This assumes that there are enough of these work items to make it worthwhile, and that thread startup is large enough to be relevant to them. That may well not be the case. Also, this could potentially be a deoptimization if it delays short-running threadpool work which would otherwise grab that idle thread.

details #104972 (comment)

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Jul 19, 2024
Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

@mangod9 mangod9 removed the untriaged New issue has not been triaged by the area owner label Jul 19, 2024
@mangod9 mangod9 added this to the 10.0.0 milestone Jul 19, 2024
@kouvel kouvel modified the milestones: 10.0.0, Future Aug 26, 2024
@kouvel
Copy link
Member

kouvel commented Aug 26, 2024

The frequency of completing tasks flagged as long-running would have to be large for this to be worthwhile. Also relevant may be separating the concept of "long-running" between "long-running-blocking" and "long-running-cpu-bound", as the latter types of work items might complete more frequently than the former, and the former types of work items may not complete at all. The blocking work items probably shouldn't go into the thread pool. The cpu-bound work items could probably be better handled by the thread pool.

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

No branches or pull requests

3 participants