Threading in Python: Overview
Python threading allows you to have different parts of your program run concurrently and can simplify your design. If you’ve got some experience in Python and want to speed up your program using threads, then this course is for you!
In this course, you’ll learn:
- What threads are
- How to create threads and wait for them to finish
- How to use a
ThreadPoolExecutor
- How to avoid race conditions
- How to use the common tools that Python
threading
provides
This course assumes you’ve got the Python basics down pat and that you’re using at least version 3.6 to run the examples. If you need a refresher, you can start with the Python Learning Paths and get up to speed.
If you’re not sure if you want to use Python threading
, asyncio
, or multiprocessing
, then you can check out Speed Up Your Python Program With Concurrency.
00:00 Hello, and welcome to an Introduction to Threading in Python. My name is Lee. In this first video, we’re just going to look at what you’re going to get from this course. By taking this course, you’re going to end up with a solid understanding of threads and how programs get executed.
00:18
You’re going to get familiar with a few different Python modules, including threading
, concurrent.futures
, and queue
. You’re going to learn threading “the hard way.” By doing things manually, step by step, it’s going to be a little bit ugly, but then we’re going to refactor and use some of the features from the modules listed above to do multi-threading “the easy way.” Through this process of struggling and doing things slowly and manually, you’ll end up with a better understanding of how things are working underneath the hood. Towards the end of this course, you’re going to build a full blown thread-safe message queue system.
00:57 If you don’t know what thread-safe means, you definitely will by the end of this course, so stick around and I will see you in the next video.
Become a Member to join the conversation.