[00:00:20] Only at the highest level if you really squinted from 50,000 feet up. Might you look at parallelism and asynchronicity and say they're the same thing. There's important differences. So let me give you metaphorically how to kind of work through that. Parallelism versus non-parallelism, which we'll sort of group asynchronicity into non-parallelism for now and I'll explain that more.
[00:00:43] So non-parallelism would be like you waiting in line at amusement park for a roller coaster. Lots of people in line and you finally get up to the front of the line. There's a roller coaster there with 30 seats on it but they only let you on. And you're the only person that can ride at any given point.
[00:01:01] So even though there's capacity for 30 people to ride, at any given moment, only one person is riding the ride. That would be non-parallel. We'll give those different terms in a moment. They'd be non-parallel versus if you waited in line. You got up there and then 30 people loaded onto the roller coaster.
[00:01:17] And when the roller coaster is running, all 30 of you are experiencing the roller coaster at exactly the same instant. That's more parallelism. So in a computing sense, parallelism is expressed through threads. Most commonly expressed through threads. The idea that I could have one thread on one CPU core in my system.
[00:01:35] And another thread. They're are kind of like queues of actions that need to happen, or operations and need to happen. At any given instant, one core could be doing one of those operations, and in exactly that same moment, another operation could be happening on a different core. That's true.
[00:01:51] Honest to goodness parallelism. Now, even with the most powerful of the machines that you may have out there. You may have a 16 core, or maybe you have a 32. Most of us probably have 4, 8 cores in our computers. 32 threads is not nearly enough to run a modern operating system with the types of thing, the multitasking that we do with running all the programs we run.
[00:02:12] Even your browser, your single browser might take up 10 or 15 threads just for basic operations that it does on a web page. So if you've ever opened up the Task Manager of Chrome and seen all the processes that are running, it runs an awful lot of stuff In parallel.
[00:02:27] So because we don't have infinite numbers of cores, the operating system actually has a layer that we would call sort of virtual threads. And it takes care of scheduling the virtual threads. It can hand out tens of thousands of those. And it takes care of trying to schedule those across the cores so that they're happening as and as much in parallel as possible.
[00:02:46] From the perspective of your programming, you don't really care about that or even know what cores they're running on. You just assume that these two things are on separate threads, that the operating system will do the right thing and make sure that they're running separately. Right, so obviously parallelism is about optimization, right?
[00:03:02] If I've got a bunch of things to do. I don't wanna wait to do the second set of tasks until the first set of tasks is finished, if it's possible to do both at the same time, if I can get done faster, that's much better. Parallelism is about optimization.
[00:04:51] So even though they are functionally operating on independent threads. They cannot communicate in a threaded fashion, they have to communicate back on that single threaded notion through the event loop.