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

Dedicated threadpool for blocking tasks #137

Open
mratsim opened this issue May 16, 2020 · 0 comments
Open

Dedicated threadpool for blocking tasks #137

mratsim opened this issue May 16, 2020 · 0 comments

Comments

@mratsim
Copy link
Owner

mratsim commented May 16, 2020

From #132,

A lot of IO APIs are blocking, for example readline().

As such they should not be scheduled on the Weave threadpool as it would prevent scheduling of Work and then block the whole runtime.

Instead a dedicated threadpool for block tasks should be introduced with a spawnBlocking call.

We are not concerned with load balancing or potentially distributed scheduling so a bag of threads waiting for work on a condition variable is enough.
The number of threads in the pool can be adjusted dynamically with a timeout on the condition variable and if thread is not scheduled before the timeout it is removed from the pool.

This introduces a start delay if threads are not used often but it allows handling say 10 terminals + readlines and scale down when threads are unneeded.

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

1 participant