filmov
tv
How to Achieve TRUE Parallelism in Python with Multiprocessing [tutorial]

Показать описание
Multithreading and multiprocessing allow computers to multitask and perform various tasks at the same time.
These concepts also help provide insane speedups to Python code.
In this video, we explore the multiprocessing module in Python and go over the main features.
We look at how multiprocessing can speed up a CPU bound application, we also look at how to achieve interprocess communication through Queues and how to use shared variables using Values. Finally, we uncover the importance of locks in concurrent and parallel tasks touching upon race conditions and how locks help prevent them. All this is shown using practical, real life examples!
Source code:
00:00 intro
00:36 speed up with multiprocessing
02:28 using cpu count for num processes
03:00 Interprocess communication with Queue
04:10 Pools to streamline process creation
06:12 Race conditions and Locks
07:13 Sharing objects through Value and Array
08:23 Race conditions uncovered (no locks)!
09:17 Solving it through locks!
10:15 Code messed up if not using Value!
11:07 Let me know if you want more videos on this :)
Please consider liking if you found the video useful and subscribe for more!
These concepts also help provide insane speedups to Python code.
In this video, we explore the multiprocessing module in Python and go over the main features.
We look at how multiprocessing can speed up a CPU bound application, we also look at how to achieve interprocess communication through Queues and how to use shared variables using Values. Finally, we uncover the importance of locks in concurrent and parallel tasks touching upon race conditions and how locks help prevent them. All this is shown using practical, real life examples!
Source code:
00:00 intro
00:36 speed up with multiprocessing
02:28 using cpu count for num processes
03:00 Interprocess communication with Queue
04:10 Pools to streamline process creation
06:12 Race conditions and Locks
07:13 Sharing objects through Value and Array
08:23 Race conditions uncovered (no locks)!
09:17 Solving it through locks!
10:15 Code messed up if not using Value!
11:07 Let me know if you want more videos on this :)
Please consider liking if you found the video useful and subscribe for more!