我的工作应该使用并行技术,我是 python 的新用户.所以我想知道你是否可以分享一些关于 python multiprocessing 和 subprocess 模块的材料.这两者有什么区别?
My work should use parallel techniques, and I a new user of python. So I wonder if you could share some material about the python multiprocessing and subprocess modules. What is the difference between these two?
subprocess 模块让您可以运行和控制其他程序.任何可以从计算机上的命令行开始的东西,都可以通过这个模块运行和控制.使用它来将外部程序集成到您的 Python 代码中.
The subprocess module lets you run and control other programs. Anything you can start with the command line on the computer, can be run and controlled with this module. Use this to integrate external programs into your Python code.
multiprocessing 模块允许您将用 python 编写的任务划分到多个进程中,以帮助提高性能.它提供了一个非常类似于 threading 模块的 API;它提供了在它创建的进程之间共享数据的方法,并使管理多个进程以运行 Python 代码的任务(更)容易.换句话说,multiprocessing 让您可以利用多个进程通过并行执行代码来更快地完成任务.
The multiprocessing module lets you divide tasks written in python over multiple processes to help improve performance. It provides an API very similar to the threading module; it provides methods to share data across the processes it creates, and makes the task of managing multiple processes to run Python code (much) easier. In other words, multiprocessing lets you take advantage of multiple processes to get your tasks done faster by executing code in parallel.
这篇关于多进程和子进程有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
Python 多处理模块的 .join() 方法到底在做什么?What exactly is Python multiprocessing Module#39;s .join() Method Doing?(Python 多处理模块的 .join() 方法到底在做什么?)
在 Python 中将多个参数传递给 pool.map() 函数Passing multiple parameters to pool.map() function in Python(在 Python 中将多个参数传递给 pool.map() 函数)
multiprocessing.pool.MaybeEncodingError: 'TypeError("multiprocessing.pool.MaybeEncodingError: #39;TypeError(quot;cannot serialize #39;_io.BufferedReader#39; objectquot;,)#39;(multiprocessing.pool.MaybeEnc
Python 多进程池.当其中一个工作进程确定不再需要Python Multiprocess Pool. How to exit the script when one of the worker process determines no more work needs to be done?(Python 多进程池.当其中一
如何将队列引用传递给 pool.map_async() 管理的函数How do you pass a Queue reference to a function managed by pool.map_async()?(如何将队列引用传递给 pool.map_async() 管理的函数?)
与多处理错误的另一个混淆,“模块"对象没yet another confusion with multiprocessing error, #39;module#39; object has no attribute #39;f#39;(与多处理错误的另一个混淆,“模块对象