Parallel Tasks in a Pool of Threads and Processes

Опубликовано: 05 Август 2024
на канале: 2MinutesPy
2,148
208

In this video, we will discuss a super interesting topic in Python - concurrent.futures (ThreadPoolExecutor and ProcessPoolExecutor).

It allows us to run numerous tasks at the same time via threads or processes, making our programs faster and more efficient.

We can use one of two classes:
ThreadPoolExecutor
ProcessPoolExecutor.

The ThreadPoolExecutor is useful for I/O-bound operations such as reading files or sending network requests. ProcessPoolExecutor is more suited for CPU-intensive operations, such as mathematical computations.

Chapters:
⏩ 0:00 What is concurrent.futures in Python
⏩ 0:37 How to use it
⏩ 0:59 Example
⏩ 1:24 Why should we use it
⏩ 1:42 ThreadPoolExecutor - real-world example
⏩ 1:58 ProcessPoolExecutor - real-world example
⏩ 2:19 Outro

✨More on 2MinutesPy👇👇

▶️ Different ways to achieve Concurrency in Python?    • Different ways to achieve Concurrency...  

▶️ asyncio in Python - Async/Await:    • asyncio in Python - Async/Await  

▶️ Race Condition and How to Solve it - threading.Lock:    • Race Condition and How to Solve it - ...  

▶️Python Threading in 2 Minutes:    • Python Threading in 2 Minutes: Run Mu...  

▶️ Global Interpreter Lock (GIL) in Python?    • Global Interpreter Lock (GIL) in Pyth...  

Subscribe to    / @2minutespy   for more such videos.

@2MinutesPy

#concurrency #concurrent #asynchronousprogramming #concurrent.futures #python #pythonprogramming #threadpoolexecutor #processpoolexecutor #2minutespy


Смотрите видео Parallel Tasks in a Pool of Threads and Processes онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь 2MinutesPy 05 Август 2024, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 2,14 раз и оно понравилось 20 людям.