How to Deal With Concurrency in Python

preview_player
Показать описание
There are 3 common ways to deal with concurrency in Python: threading, asyncio and multiprocessing. Watch the short to find out when to which.

#arjancodes #softwaredesign #python
Рекомендации по теме
Комментарии
Автор

I'd really love a full example showing all those three methods. maybe an example with two groups of tasks (IO bound and CPU bound), then showing how we could improve the code performance starting by multithreading, asyncio, and then multiprocessing

abdelghafourfid
Автор

asyncio is for when the bottlenecks in your code lie in the I/O, the network, or in a GUI waiting for user responses, that kind of thing. Threads and processes are for handling CPU-intensive activities: you’re not going to take advantage of multiple CPUs without them.

Currently threads are mainly useful if the heavy work is being done in an extension module, since native Python code itself is hampered by the GIL. But this might improve in future, thanks to things like the “nogil” project.

lawrencedoliveiro
Автор

Highly appreciate your content. Thanks!
Those shutterstock snippets are more distracting than entertaining. I would leave it - simplify your edit and makes it better digestible for the viewer.

sENkyyy
Автор

You should do a video on asyncio, subprocess, threading, and subinterpretors

Spitfire
Автор

I don't understand asyncio, since it needs async def to be defined. since I have large code base with sync it becomes difficult to use asyncio.

dharikarsath
Автор

I thought concurrency is a memory thing, not necessarily a parallel thread concept with multiple threads.

kayakMike
Автор

But switching between multiple processes isn’t that efficient in comparison to threads switching.
All this is coming at the cost of efficiency 🤔

utkarshsharma
visit shbcf.ru