What do we mean by an idle thread? And when does it occur? Context : ThreadPoolExecutor - it says even if there is an idle thread, if the corePoolSize is small, a new thread is created
In this context an idle thread is one that is owned/held by the ThreadPoolExecutor and is not currently running any Runnable/Callable.
When work is submitted to the TPE, and if an idle thread is chosen, then it becomes active and runs the Runnable/Callable. Once the Runnable/Callable completes the thread goes back to being idle (but may immediately become active again if there is more work to do and the TPE choses to use that now available thread).
it simply means when ThreadPool does not have any task to be executed or has more active threads than tasks available, then the excess thread go idle. It means they simply are not available to the scheduler (aka in sleep state).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With