What is thread pool? Why should we use thread pools?

Ans: A thread pool is a collection of threads on which task can be scheduled. Instead of creating a new thread for each task, you can have one of the threads from the thread pool pulled out of the pool and assigned to the task. When the thread is finished with the task, it adds itself back to the pool and waits for another assignment. One common type of thread pool is the fixed thread pool. This type of pool always has a specified number of threads running; if a thread is somehow terminated while it is still in use, it is automatically replaced with a new thread. Below are key reasons to use a Thread Pool
  • Using thread pools minimizes the JVM overhead due to thread creation. Thread objects use a significant amount of memory, and in a large-scale application, allocating and de-allocating many thread objects creates a significant memory management overhead.
  • You have control over the maximum number of tasks that are being processed in parallel (= number of threads in the pool).
Most of the executor implementations in java.util.concurrent use thread pools, which consist of worker threads. This kind of thread exists separately from the Runnable and Callable tasks it executes and is often used to execute multiple tasks.

People who read this post also read :



11 comments:

Nice post,Its very interesting and very helpful for us.Thank you for sharing it with us.

finally clear my doubt...thanks

now i know exactly about Tread pool...Thanks

Hi there :) I will be implementing my first erp fairly soon, and I just can't wait to see how it's going to be like! I decided to get this one: https://ax-dynamics.com/dynamics-365/for-operations, what do you think about it?

If you're looking to lose weight then you certainly have to try this totally brand new personalized keto meal plan diet.

To design this keto diet, licensed nutritionists, fitness couches, and professional cooks have joined together to develop keto meal plans that are productive, decent, money-efficient, and delicious.

Since their grand opening in January 2019, thousands of individuals have already transformed their body and health with the benefits a proper keto meal plan diet can give.

Speaking of benefits; in this link, you'll discover 8 scientifically-proven ones offered by the keto meal plan diet.

Do you understand there's a 12 word sentence you can say to your crush... that will trigger intense feelings of love and instinctual attractiveness for you buried within his chest?

Because hidden in these 12 words is a "secret signal" that fuels a man's impulse to love, please and guard you with his entire heart...

12 Words Who Trigger A Man's Desire Response

This impulse is so built-in to a man's genetics that it will make him work harder than ever before to do his best at looking after your relationship.

Matter-of-fact, triggering this powerful impulse is so essential to having the best possible relationship with your man that the moment you send your man one of these "Secret Signals"...

...You'll instantly find him expose his mind and soul to you in such a way he never expressed before and he'll see you as the only woman in the world who has ever truly interested him.

HVAC & Plumbing Services
Air Star Heating guarantees reliability and quality for all equipment and services.

Air Star Heating specialists always try to deliver the most excellent quality of services to our customers at an affordable price. It is understood that every client has different needs and different problems. We try to accomplish the needs of every client according to their requests. We are having considerable experience in this field. Our specialists understand very well how things work. It doesn’t matter in which field of industry you are looking for services.
Plumbing & HVAC Services in San Diego. Call now (858) 900-9977 ✓Licensed & Insured ✓Certified Experts ✓Same Day Appointment ✓Original Parts Only ✓Warranty On Every Job.
Visit:- https://airstarheating.com

The 13 best Casino in Las Vegas, Nevada | Mapyro
It's a bit like a 태백 출장마사지 Vegas Strip hotel, but 남원 출장마사지 The Strip offers an 태백 출장안마 excellent mix of luxury and modern design, with the added perks of 김포 출장샵 access to 남원 출장안마

Post a Comment

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More