This article describes the Thread Pool design pattern. This is a concurrency design pattern, a category of design pattern used by software engineers, when writing computer programs.
The Thread Pool pattern is a design pattern, used in software engineering to organise the processing of a large number of queued tasks through a smaller/limited number of threads. Results can also be queued. When a thread finishes it's task it requests another. If none are available, the thread can wait or terminate. The size of the thread pool is a tuning parameter that allows fine tuning of resource usage and responsiveness, for best results. Pooling threads helps improve performance by saving time creating the thread, however, too many idle threads can consume resources. The number of threads is based on percentage used of CPU, queued requests, and/or the number of processors in the system. This pattern is defined as a concurrency design pattern because it relates to thread management.
↑ Return to Top
Better performance is the main gain with this pattern. Juggling the various factors that determine performance becomes more important as computers leaverage multiple processor cores. If the number of tasks is large, creating a thread for each may become impossible or impractical, so the best answer is a thread pool.
A web server increases of decreases the number of request processing threads, depending on load.
XAML guy edited Original. Comment: tidied sections
XAML guy edited Revision 1. Comment: counter
XAML guy edited Revision 2. Comment: added content
XAML guy edited Revision 3. Comment: added links