Chapter 21
Thread Pools
For performance reasons, threads are often pooled. Pooling helps reduce thread creation by reusing threads and makes it easier to place a bound on the number of active threads. A thread pool consists of generic workers that collectively execute the tasks submitted to the pool. Different types of thread pools exist, characterized by various properties: fixed or flexible number of workers, bounded or unbounded queue of tasks, scheduling and delaying facilities, and so on. Applications can use thread pools explicitly by submitting tasks directly to workers. Additionally, some languages define structures that can process their contents in parallel by submitting internal tasks to a thread pool. In functional and hybrid languages, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access