How would you implement a thread pool?

How would you implement a thread pool?

ThreadPools are useful when you need to limit the number of threads running in your application. Built in thread pools in the java.util.concurrent package.

Thread pools address two different problems :-
They usually provide improved performance when executing large numbers of asynchronous tasks, due to reduced per-task invocation overhead, and they provide a means of bounding and managing the resources, including threads, consumed when executing a collection of tasks. 


Each ThreadPoolExecutor also maintains some basic statistics, such as the number of completed tasks.


By:
Date:2018-05-15 00:00:00

Thread Pools are useful when you need to limit the number of threads running in your application. Built in thread pools in the java.util.concurrent package.

Thread pools address two different problems: they usually provide improved performance when executing large numbers of asynchronous tasks, due to reduced per-task invocation overhead, and they provide a means of bounding and managing the resources, including threads, consumed when executing a collection of tasks. 


Each ThreadPoolExecutor also maintains some basic statistics, such as the number of completed tasks.


By:Sumit Tripathi
Date:2018-05-15 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related Java Subjective Links

Java Subjective interview questions and answers for experienced and fresher