Async Techniques and Examples in Python Transcripts
Chapter: Threads
Lecture: Python async landscape: Threads
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Threads have been around and available in Python for a long time and using threads for parallel programming
0:07
is certainly one of the main ways in which we can add concurrency to our Python programs. Let's quickly look at our landscape here.
0:16
So we're over in this green threads box and that generally puts us in the do more at once. So threads are very similar to AsyncIO in that sense.
0:26
Because of the Python GIL, the Global Interpreter Lock that we spoke about in the Introduction to Async Programming in Python chapter
0:33
threads don't really let us leverage the multiple cores to do actual concurrent CPU-bound operations. Some languages they do, in Python they don't.
0:42
That puts thread concept squarely in the do more once category in our little landscape here. So we're going to focus on threads
0:51
this is, like I said, it's been around for a long time so many different systems are built taking advantage of threads.
0:57
And there's still many good use cases for them and certainly understanding how they work and how to use them in Python is critical
1:04
to having a well-rounded, asynchronous programming tool set.