So far, we have seen what concurrent programming is and learned about processes and threads. Now we are going to apply our knowledge of these concepts using Python! In this lesson, we are going to learn about three modules:
threading
asyncio
multiprocessing
These modules can help speed up programs and provide design clarity. We will walk through what they are and practice writing short programs with them. Along the way, think back to the previous article and lesson you read. Make sure you understand the connection between these modules and the concepts we have covered already.
Let’s get started!
Instructions
Much of this lesson will involve comparing the efficiency and behavior of sequential programming with concurrent programming.
In script.py, you should see a sequential program with a timer. We will use the timer throughout this lesson to track how long each program takes to run.
After you have looked over the code a bit, click Run to move onto the next exercise.