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

Feature request: A task scheduler with a fixed number of threads separate from the main pool #245

Open
GSPP opened this issue Dec 30, 2021 · 2 comments
Assignees

Comments

@GSPP
Copy link

GSPP commented Dec 30, 2021

Sometimes, you want to isolate a workload from the main thread pool. For example, when you start a Parallel loop in a fresh process, this sometimes immediately exhausts the thread pool. This crowds out other work and even stops timers from firing until the pool responds.

I know of no built-in way to achieve this.

I use the WorkStealingTaskScheduler from the old ParallelExtensionsExtras for this purpose. The library is long abandoned and not supported.

It should be possible to set the thread priority (maybe through a callback that notified user code when a thread was created so that it can be configured arbitrarily).

@StephenCleary
Copy link
Owner

A custom thread pool is out-of-scope for this (async-oriented) library.

Generally, most devs handle this by boosting the minimum thread pool count and then using ConcurrentExclusiveSchedulerPair (which migrated into the BCL from ParallelExtensionsExtras). Is there a reason that approach wouldn't work for you?

@StephenCleary StephenCleary self-assigned this Dec 30, 2021
@GSPP
Copy link
Author

GSPP commented Dec 31, 2021

Yeah, that's what I do sometimes. It seems unclean, though, to alter global state for everything that lives in the process to solve a local problem.

I know about using ConcurrentExclusiveSchedulerPair to limit parallelism but that's not enough here.

If this is out of scope feel free to close.

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

No branches or pull requests

2 participants