3 ms·
The problem is the GIL : https://wiki.python.org/moin/GlobalInterpreterLock https://wiki.python.org/moin/GlobalInterpreterLock Multiprocessing allows you to us
by wdroz 9y ago
The problem is the GIL : https://wiki.python.org/moin/GlobalInterpreterLock https://wiki.python.org/moin/GlobalInterpreterLock
Multiprocessing allows you to use all cores, but you can't share memory like in threads. So you have to Serialize/Deserialize a lot for exchange data.
If your serializations cost are low and need computation power, you should use multiprocessing. If you are just waiting I/O you can use threads.
BTW, modern python "ProcessPoolExecutor" is not designed for compute heavy batch like "Pool" from "multiprocessing".