multiprocessing.Process
时间: 2023-10-21 10:05:32 浏览: 124
multiprocessing
multiprocessing.Process是multiprocessing模块中的一个类,用于创建子进程。可以通过实例化Process类并设置target参数来指定子进程要执行的函数,然后通过调用start()方法启动子进程。在引用中的代码示例中,通过导入multiprocessing模块和使用Process类创建了一个子进程p1,并设置了执行函数work1。然后通过调用p1.start()方法启动了子进程p1。同时,在主进程中也有一个循环打印“这是主进程”。另外,引用中还提到了获取进程的名称和pid的方法,<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Python编程之多进程(multiprocessing)详解](https://blog.csdn.net/qq_39415941/article/details/127551383)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [Python进程multiprocessing. Process()的使用](https://blog.csdn.net/weixin_38819889/article/details/103546935)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文