LernerPython

Threads and processes (Oct 2021 webinar)

Want to do more than one thing at a time? Python offers both threads and processes. In this recording of a webinar from 2021, I’ll walk you through various techniques for concurrency in Python

What you should know

Course Content

Course length

3.5 hours

Number of lessons

1

Training materials

1 Jupyter notebook

Coding exercises

5

LEARN MORE

Long ago, computers could do only one thing at a time. But nowadays, we expect to ask our computer to do many things in parallel. To do this, programmers can typically choose between two main options — threads and processes.

Python provides support for both threads and processes. But using them can be tricky, difficult, and a bit strange — thanks to a combination of Python syntax, limitations on what we can do with threads and processes, and the infamous GIL (global interpreter lock), which ensures that only a single thread runs at a time.

In this four-hour course that I gave in October 2021, I showed how we can work with threads and processes in Python. Moreover, I show you when you should (and shouldn’t) use these techniques, how to weigh them against one another, and some tips and tricks for using them effectively.

Whether you’re new to threads and processes, have experience with them in another language and want to use them in Python, or want to have a better understanding of how Python allows us to work with them, this course will give you lots of understanding and tools.

  • Threads vs. processes
  • Python’s GIL
  • Creating threads
  • Passing data to and from threads
  • Locking
  • concurrent.futures
  • ThreadPoolExecutor
  • Using “map”
  • Multiprocessing
  • ProcessPoolExecutor

This course, like all others on LernerPython.com, is taught by Reuven Lerner.