Parallel Tasks in a Pool of Threads and Processes

preview_player
Показать описание

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: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👇👇

@2MinutesPy

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

I commented before requesting a video about concurrent.futures. You're welcome

fdauti_ca
Автор

also Id like to request a video about multiprocessing and not having the annoying gıl

compositeboson
Автор

I’m coming from JS to the Python word now; could I shallowly compare the ThreadPoolExecutor with Promises?

passaroquetemasanaovoa
Автор

naah, multiprocessing is better because we dont have gıl there

compositeboson