Incase thread pool, when thread complete it work, then it will go to dead state, then how it will go back to thread pool. What they have implemented under the hood.
A Thread Pool is an alternative to creating a new thread per task to execute. Instead, a number of pre-created threads exist in a pool - into which you can submit tasks to be executed by these pooled threads. New tasks submitted to the pool are first stored internally in a queue. From this queue the pooled threads will take the tasks and execute them. Each thread in the thread pool executes in a loop that takes a new task from the internal task queue in the thread pool (or block if no tasks are available), executes the task, and then tries to take another task etc. repeatedly. If you want to know more about the internals, then you can read more about concurrency in multithreading and Executor framework.
@@rakeshpal8730 Hi Rakesh thanks for the brief but honestly we know all this, our question is different. Each thread dies after executing the "run" method then how has Threadpool done the implementation internally such that threads don't die but are rather re-used
Just resumed the Live sessions from this week. You can raise an enquiry for the follow up. Incase you are a paid user, check your respective groups for updates.