Async Techniques and Examples in Python Transcripts
Lecture: Python async landscape: Threads
0:00 Threads have been around and available
0:02 in Python for a long time
0:04 and using threads for parallel programming
0:06 is certainly one of the main ways in which we can
0:09 add concurrency to our Python programs.
0:12 Let's quickly look at our landscape here.
0:15 So we're over in this green threads box
0:17 and that generally puts us in the do more at once.
0:21 So threads are very similar to AsyncIO in that sense.
0:25 Because of the Python GIL, the Global Interpreter Lock
0:28 that we spoke about in the Introduction to Async
0:30 Programming in Python chapter
0:32 threads don't really let us leverage the multiple cores
0:35 to do actual concurrent CPU-bound operations.
0:38 Some languages they do, in Python they don't.
0:41 That puts thread concept squarely in the
0:44 do more once category in our little landscape here.
0:48 So we're going to focus on threads
0:50 this is, like I said, it's been around for a long time
0:52 so many different systems are built
0:54 taking advantage of threads.
0:56 And there's still many good use cases for them
0:58 and certainly understanding how they work
1:00 and how to use them in Python is critical
1:03 to having a well-rounded, asynchronous programming tool set.