python multiprocessing
HTML-код
- Опубликовано: 7 фев 2025
- A look into simultaneous multiprocessing in python using the multiprocessing library.
I will show arguably the most useful class Pool() and it's most powerful function starmap().
We will see how multiprocessing is NOT beneficial in all circumstances.
In particular if the function intended to be simultaneously processed is very simple, or the function will not be called many times, multiprocessing can actually be much slower than doing it single core.
And while I did not say this in the video explicitly, using more processes than available cores, will not provide any improvment beyond the actual number of cores!.
Note: at 03:20 I should also add that many CPUs run at a higher clock frequency when fully utilizing a single core, hence using 8 cores will often run 10-15% slower per core!
link to talked about article: www.hebergemen...
thanks a lot my brother you told the real truth please make more videos like this.
love from India .
Great class!
thank you, that's very graphic
bro please can solve this ?
create a python program to demonstrate Multi Processing capability. the program must create 2 processes(not threads). these processes must be able to communicate/share data with each other. they must have the following properties.
Process properties
1) Must take in their name (which can be any string ) as function argument when created.
2) Must take an integer nLoops as function argument.
3) The processes must loop nLoops times. For each iteration, one of the processes must share its iteration indes (Eg. 0 for first iteration, 1 for second iteration, nLoops for last iteration etc. ) with the second process. The second process should receive all the information sent from the forst process and print them.