-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
area-System.Threadingin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Milestone
Description
- Currently, when just one work item is queued to the thread pool, two threads are released. When just one async IO completes, three threads are released.
- In async IO completion dispatchers such as this, don't parallelize dispatching unless there is actually another work item to process
- Similarly in the thread pool work item dispatcher, don't parallelize dispatching unnecessarily. In the thread pool dispatcher, another work item could be dequeued and set aside before parallelizing, the next thread would process the work item that was set aside (or some other thread would pick up the work item).
- Both use similar parallelizing schemes, investigate modifying the schemes to 3-stage schemes to avoid an enqueuer from requesting a thread while another thread is already looking for work to determine whether to parallelize further. This would ensure that threads are requested sequentially, and avoid overeager parallelization in some cases.
- These should help to reduce CPU usage in scenarios where the thread pool gets periodic short bursts of work
- May also be relevant to:
jasper-d, NinoFloris, antoniofreire and ericsampson
Metadata
Metadata
Assignees
Labels
area-System.Threadingin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged