Concurrency and Async Programming

Learning PathSkills: Python, Concurrency, Async IO, Global Interpreter Lock, Thread Safety, Parallel Processing, Performance Optimization, Multithreading, Async Iterators, Free Threading

Speed Up Your Python Program With Concurrency

Python can do more than one thing at a time, but which tool you reach for depends on whether your work is I/O-bound or CPU-bound. You’ll start with an overview of Python’s concurrency options, then dig into the GIL that shapes all of them. From there, you’ll write threaded code and keep it safe with locks, build asynchronous programs with async/await and asyncio, and finish with parallel processing and free-threaded Python.

Concurrency and Async Programming

Learning Path ⋅ 10 Resources

Understanding Python Concurrency

Before diving deep, get an overview of what concurrency means in Python. You’ll learn about the different approaches to running code concurrently and when to use each one.

Title image for Speed Up Python With Concurrency (Speed Up Your Python Program With Concurrency)

Course

Speed Up Python With Concurrency

Learn what concurrency means in Python and why you might want to use it. You'll see a simple, non-concurrent approach and then look into why you'd want threading, asyncio, or multiprocessing.

Title image for Python Concurrency (Speed Up Your Python Program With Concurrency)

Interactive Quiz

Python Concurrency

The Global Interpreter Lock (GIL)

You’ve seen what concurrency means in Python and which approach suits which kind of work. Next, you’ll look at the GIL, the CPython lock that decides how much those approaches can actually speed up your code. Understanding it explains the threading and async trade-offs you’ll meet through the rest of this path.

Title image for Understanding Python's Global Interpreter Lock (GIL) (What is the Python Global Interpreter Lock (GIL)?)

Course

Understanding Python's Global Interpreter Lock (GIL)

Python's Global Interpreter Lock or GIL, in simple words, is a mutex (or a lock) that allows only one thread to hold the control of the Python interpreter at any one time. In this video course you'll learn how the GIL affects the performance of your Python programs.

Working With Threads

Now that you know why only one thread runs Python bytecode at a time, you can see where threads still pay off, namely I/O-bound work. You’ll use Python’s threading module, then guard shared state with locks and other techniques that keep race conditions out of your code.

Title image for Threading in Python (An Intro to Threading in Python)

Course

Threading in Python

In this intermediate-level course, you'll learn how to use threading in your Python programs. You'll see how to create threads, how to coordinate and synchronize them, and how to handle common problems that arise in threading.

Title image for Python Threading (An Intro to Threading in Python)

Interactive Quiz

Python Threading

Title image for Thread Safety in Python: Locks and Other Techniques (Python Thread Safety: Using a Lock and Other Techniques)

Course

Thread Safety in Python: Locks and Other Techniques

Learn about the issues that can occur when your code is run in a multithreaded environment. Then you'll explore the various synchronization primitives available in Python's threading module, such as locks, which help you make your code safe.

Asynchronous Programming With asyncio

Threads share memory, so you have to lock it. Async programming takes the other route, running I/O-bound work cooperatively in one thread. You’ll trace how coroutines grew out of generators, write async/await code with asyncio, and build asynchronous iterators and iterables of your own.

Title image for Async Programming in Python: From Generators to asyncio (Async Programming in Python: From Generators to asyncio)

Tutorial

Async Programming in Python: From Generators to asyncio

Learn how Python async programming works. Write async functions with async and await, and run slow I/O operations concurrently with asyncio.

Title image for Hands-On Python 3 Concurrency With the asyncio Module (Async IO in Python: A Complete Walkthrough)

Course

Hands-On Python 3 Concurrency With the asyncio Module

Learn how to speed up your Python 3 programs using concurrency and the asyncio module in the standard library. See step-by-step how to leverage concurrency and parallelism in your own programs, all the way to building a complete HTTP downloader example app using asyncio and aiohttp.

Title image for Exploring Asynchronous Iterators and Iterables (Asynchronous Iterators and Iterables in Python)

Course

Exploring Asynchronous Iterators and Iterables

Learn to build async iterators and iterables in Python to handle async operations efficiently and write cleaner, faster code.

Going Beyond the GIL

For CPU-bound tasks, you’ll need to bypass the GIL. Learn about parallel processing techniques and Python 3.13’s new free-threading capabilities.

Title image for Bypassing the GIL for Parallel Processing in Python (Bypassing the GIL for Parallel Processing in Python)

Tutorial

Bypassing the GIL for Parallel Processing in Python

In this tutorial, you'll take a deep dive into parallel processing in Python. You'll learn about a few traditional and several novel ways of sidestepping the global interpreter lock (GIL) to achieve genuine shared-memory parallelism of your CPU-bound tasks.

Title image for Python 3.13: Free Threading and a JIT Compiler (Python 3.13 Preview: Free Threading and a JIT Compiler)

Tutorial

Python 3.13: Free Threading and a JIT Compiler

Python 3.13 enhanced Python performance. Make a custom Python build with Docker to enable free threading and a JIT compiler. Learn how these features affect the language's ecosystem.

Test Your Knowledge

You’ve made it through the entire path! In the wrap-up quiz below, you’ll revisit the most important ideas about Python concurrency, the GIL, threading, thread safety, asyncio, async iterators, and free-threaded Python 3.13. Use it to spot any topics that still feel rusty before moving on.

Title image for Concurrency and Async Programming (Speed Up Your Python Program With Concurrency)

Interactive Quiz

Concurrency and Async Programming

Test your understanding of Python concurrency, the GIL, threading, thread safety, asyncio, async iterators, and free-threaded Python 3.13.

Congratulations on completing this learning path! You’ve learned how Python handles concurrency, from the fundamentals through threading, async programming, and strategies for bypassing the GIL.

Continue your advanced Python journey with the next learning path:

Learning Path

Database Access With Python

9 Resources ⋅ Skills: SQL Libraries, SQLite, SQLAlchemy, Redis, MySQL, MongoDB, ChromaDB, Data Management, NoSQL Databases, Vector Databases, DuckDB, TinyDB, SQL Security

You might also be interested in these related learning paths:

Got feedback on this learning path?

Looking for real-time conversation? Visit the Real Python Community Chat or join the next “Office Hours” Live Q&A Session. Happy Pythoning!

« Browse All Learning Paths