-
Notifications
You must be signed in to change notification settings - Fork 603
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
Should theadpool create and destroy threads dynamically? #70
Comments
I think the whole point of a thread pool (statically created threads at init time) is to avoid the overhead of creating/destroying threads repeatedly during run time. The penalty for having idle threads in the background is basically none, so it's not worth the effort to destroy them. |
Sure, creating/destroying threads may bring some overhead, but is it significant performance overhead?It may be difficult to estimate each workload when creating threads statically. Too many static threads may waste resources, and too few threads can not deal with tasks well. That is why I think it is meaningful to create/destroy threads dynamically. |
Late to the party but my two cents Other than the fact that dynamically allocating the threads would make this not a thread pool: embedded applications and other applications where heap space and cycles are severely limited exist, and using |
Current threadpool in this project creates threads statically when it is initialized. And number of threads is fixed during its lifecycle.
Why not create and destroy threads dynamically?
Create:
Destroy:
The text was updated successfully, but these errors were encountered: