Async Techniques and Examples in Python Transcripts
Chapter: Course conclusion and review
Lecture: Review: asyncio

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Open this course with a quote about what is concurrency and what is asynchrony in computer programming from Wikipedia, specifically to highlight
0:09 that it's not just about threads. It's also about multiprocessing but it's also about things like asyncio that's cooperative concurrency.
0:18 So remember, we have one main thread of execution we have a bunch of different tasks and we're going to break those tasks into little tiny slices.
0:26 Here they look kind of coarse grained but imagine we're just way zoomed in. And we break the task into different pieces
0:32 and we'll do a little bit of one, a little bit of other a little bit of another, and we interleave these while
0:38 say the green task maybe is going to go talk to a database so while it's talking to the database we can run the first part of the pink task.
0:44 We get a response from the database to want to call a webservice on the green. Well let's go try a little blue, things like that.
0:49 So we're able to come along and just run all of these tasks by interweaving them, because mostly what they're doing
0:55 is waiting on some external system, waiting on io. So this is the heart of asyncio and the async and await keywords in Python.


Talk Python's Mastodon Michael Kennedy's Mastodon