Only once everything is cooked, prepared, and layered can you place the last piece of toast onto your sandwich, slice it (optional), and eat it.īecause it requires you to perform multiple tasks at the same time, making a BLT is inherently a concurrent process, even if you are not giving your full attention to each of those tasks all at once. Once your bread is done toasting, you apply to it your sandwich spread of choice, and then you can start layering on your tomatoes, lettuce, and then, once it's done cooking, your bacon. As pieces get finished, you pull them out and place them on a plate. While it's toasting, you continue checking on your bacon. All the while, you continue checking on and occasionally flipping over your bacon.Īt this point, you've started a task, and then started and completed two more in the meantime, all while you're still waiting on the first.Įventually you put your bread in a toaster. While the bacon's cooking, you can get out your tomatoes and lettuce and start preparing (washing and cutting) them. First, you'll want to throw the bacon in a pan on medium-low heat. If that was confusing to you, let's instead think of an analogy: Say you want to make a BLT. ![]() Tasks start asynchronously, get performed asynchronously, and then finish asynchronously. Once one task is finished, it switches again to an unfinished task until they have all been performed. Instead, a process might start, then once it's waiting on a specific instruction to finish, switch to a new task, only to come back once it's no longer waiting. This is a bit misleading though, as the tasks may or may not actually be performed at exactly the same time. What's the difference between multiprocessing, asyncio, and concurrency.futures?Īn effective definition for concurrency is "being able to perform multiple tasks at once".When should you use multiprocessing vs asyncio or threading?. ![]()
0 Comments
Leave a Reply. |