Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Python中I/O操作可以并行吗';谁是执行者?_Python - Fatal编程技术网

在Python中I/O操作可以并行吗';谁是执行者?

在Python中I/O操作可以并行吗';谁是执行者?,python,Python,在CPython中,GIL不允许Python代码在并行线程中运行,但在执行I/O操作时会释放GIL 假设有几个相对较长的I/O操作:将一些原始数据转储到文件、创建日志文件条目和执行Postgres查询。如果我通过ThreadPoolExecutor运行它们,它们会并行运行吗 我最初的假设正确吗?help@Ilja事实上,这正是我所要求的。不知道为什么我以前没有找到它。谢谢

在CPython中,GIL不允许Python代码在并行线程中运行,但在执行I/O操作时会释放GIL

假设有几个相对较长的I/O操作:将一些原始数据转储到文件、创建日志文件条目和执行Postgres查询。如果我通过ThreadPoolExecutor运行它们,它们会并行运行吗


我最初的假设正确吗?

help@Ilja事实上,这正是我所要求的。不知道为什么我以前没有找到它。谢谢