threadpool | Overview | Reference | Tutorial | Examples | Design

Design | TODO5 | Thread Pool Pattern

Thread Pool Pattern

In the thread pool pattern in programming, a number of N threads are created to perform a number of M tasks, usually organized in a queue. Typically, N << M. As soon as a thread completes its task, it will request the next task from the queue until all tasks have been completed. The thread can then terminate, or sleep until there are new tasks available.

The number of threads used (N) is a parameter that can be tuned to provide the best performance.

The advantage of using a Thread Pool over creating a new thread for each task, is that thread creation and destruction overhead is negated, which may result in better performance and better system stability.

From Wikipedia , the free encyclopedia.

Copyright © 2005-2008 Philipp Henkel | Overview | Reference | Tutorial | Examples | Design