【问题标题】:What is the difference between Process.terminate() and Process.kill() in Python multiprocessing? [duplicate]Python 多处理中的 Process.terminate() 和 Process.kill() 有什么区别? [复制]
【发布时间】:2020-05-08 12:57:15
【问题描述】:

Python 多处理中Process.terminate()Process.kill() 有什么区别?

【问题讨论】:

  • 您阅读文档了吗?你不清楚哪一部分?

标签: python python-3.x python-multiprocessing


【解决方案1】:

terminate() 向进程发送SIGTERM 信号

terminate():
    Terminate the process. On Unix this is done using the SIGTERM signal; on Windows TerminateProcess() is used. Note that exit handlers and finally clauses, etc., will not be executed.

kill() 向进程发送SIGKILL 信号。

kill():
Same as terminate() but using the SIGKILL signal on Unix.

进程如何处理这些信号取决于它。通常,SIGTERM 是正常关闭,而SIGKILL 更像是中止。 More details

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-05-18
  • 2010-12-10
  • 2016-08-24
  • 2016-02-16
  • 2021-08-11
  • 1970-01-01
相关资源
最近更新 更多