Threads, Thread pool, Concurrency and Async
- CPU Intensive activities use multiprocessing
- IO intensive activities: (async)
- Calls are blocked
Lets create a simple python module which demonstrates the async
- We are supposed to download files from internet
- we have a python function
python
def download_file(url:str):
pass
- we have a python function
- When we are downloding multiple files (blocking style)
for url in urls:
download_file(url)
Async await and loop
-
Refer Here for async
-
Refer Here for examples
