From b87918050c4091c9719eeaeef46edb667f83dd70 Mon Sep 17 00:00:00 2001 From: Ilkka Seppala Date: Sun, 17 May 2015 22:04:07 +0300 Subject: [PATCH] Added Thread Pool description. --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index e1b2f47e5..61682aaa1 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ Behavioral patterns are concerned with algorithms and the assignment of responsi Concurrency patterns are those types of design patterns that deal with the multi-threaded programming paradigm. * [Double Checked Locking](#double-checked-locking) +* [Thread Pool](#thread-pool) ### Presentation Tier Patterns @@ -601,6 +602,14 @@ validation and for building to order **Applicability:** Use the Resource Acquisition Is Initialization pattern when * You have resources that must be closed in every condition +## Thread Pool [↑](#list-of-design-patterns) +**Intent:** It is often the case that tasks to be executed are short-lived and the number of tasks is large. Creating a new thread for each task would make the system spend more time creating and destroying the threads than executing the actual tasks. Thread Pool solves this problem by reusing existing threads and eliminating the latency of creating new threads. + +![alt text](https://github.com/iluwatar/java-design-patterns/blob/master/thread-pool/etc/thread-pool.png "Thread Pool") + +**Applicability:** Use the Thread Pool pattern when +* You have a large number of short-lived tasks to be executed in parallel + # Frequently asked questions