-
Notifications
You must be signed in to change notification settings - Fork 0
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
Thread pool #3
Comments
Doing some research the normal strategy is a work-stealing thread pool that uses random selection of the victims. The random selection use a back off algorithm. I think this a good strategy for small short lived tasks. Tasks can be started at any time, by any thread. If the thread is a Tasks should get flagged if they want to run in the pool, or run on a dedicated thread. There is actually no real difference for the worker. The worker will run a thread stealing task, the difference would be that the scheduler would see that I think it makes sense to have two watermarks, a low watermark and a high watermark for worker thread count. Iff starting a thread stealing task would drop the thread count below the high watermark the new thread spawn logic is called. The high watermark would be use to limit the number of pool threads, Since stealing tasks would eventually return the thread, the high watermark can be used to determine if a thread needs to be killed when it goes idle. |
Possible interface could be:
The text was updated successfully, but these errors were encountered: