相关疑难解决方法(0)

为什么numpy计算不受全局解释器锁的影响?

我正在尝试决定是否应该使用多处理或线程,并且我已经学习了一些有关Global Interpreter Lock的有趣内容.在这篇不错的博文中,似乎多线程不适合繁忙的任务.但是,我还了解到一些功能,如I/O或numpy,不受GIL的影响.

任何人都可以解释为什么,以及我如何能够找出我的(可能非常重的)代码是否适合多线程?

python multithreading numpy multiprocessing gil

10
推荐指数
1
解决办法
2219
查看次数

ProcessPoolExecutor和ThreadPoolExecutor有什么区别?

我阅读了试图获得基本理解的文档,但它仅表明ProcessPoolExecutor可以避开Global Interpreter Lock我认为是锁定变量或函数的方式,从而使并行进程不会同时更新其值。

我要寻找的是何时使用ProcessPoolExecutor,何时使用ThreadPoolExecutor以及使用每种方法时应记住的事项!

python parallel-processing multithreading python-3.x python-3.5

3
推荐指数
2
解决办法
2734
查看次数