Sitemap
Level Up Coding

Coding tutorials and news. The developer homepage gitconnected.com && skilled.dev && levelup.dev

Member-only story

Threading in Python

The threading module and the ThreadPoolExecutor class

21 min readJun 20, 2024

--

Press enter or click to view image in full size
Time spent to load twenty exotic Australian animals asynchronously
Time spent to load twenty exotic Australian animals asynchronously

Intro

This post is an introduction to multithreading in Python with the threading module and the ThreadPoolExecutor class from the concurrent.futures module.

The resources section at the end has some links to wonderful material that you can use to go deeper into the topic 🤓

Related posts

The code from this post can be found in this repository.

What is a Thread

A thread is the basic unit of execution within a process. It is an independent flow of execution that shares the same address space as other independent flows of execution within the same process. A process can have one or more threads, one of them is the main thread, which is the default thread of a Python process.

Press enter or click to view image in full size
Processes and threads
Processes and threads

📘 In Python we can use the threading module to write programs that use…

--

--