# Python Thread Pool

DevFeed: [Python Thread Pool](<https://devfeed.tech/articles/python-thread-pool-31837.md>)

Original publisher: [Read original article](<https://www.metachris.dev/2016/04/python-threadpool/>)

Author: Chris Hager

Published: 2016-04-11T00:00:00Z

Content type: tutorial

Language: en

Sources: [Chris Hager](<https://devfeed.tech/sources/chris-hager.md>)

Topics: [Python](<https://devfeed.tech/topics/python.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Concurrent Programming](<https://devfeed.tech/topics/concurrent-programming.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [batch](<https://devfeed.tech/tags/batch.md>), [code](<https://devfeed.tech/tags/code.md>), [python](<https://devfeed.tech/tags/python.md>), [queue](<https://devfeed.tech/tags/queue.md>), [tasks](<https://devfeed.tech/tags/tasks.md>), [thread](<https://devfeed.tech/tags/thread.md>), [threading](<https://devfeed.tech/tags/threading.md>), [threads](<https://devfeed.tech/tags/threads.md>)

## AI overview

This tutorial explains Python thread pools, including how a fixed group of worker threads processes queued tasks concurrently. It discusses ThreadPoolExecutor and an interruptible thread queue implementation for Python 2.x and 3.x.

## Source excerpt

A thread pool is a group of pre-instantiated, idle threads which stand ready to be given work. These are often preferred over instantiating new threads for each task when there is a large number of (short) tasks to be done rather than a small number of long ones. Suppose you want do download 1000s of documents from the internet, but only have resources for downloading 50 at a time. The solution is to utilize is a thread pool, spawning a fixed number of threads to download all the URLs from a queue, 50 at a time.