1

这个简单的 Python 程序:

import threading
import time
import os

def run_test():

    print("run_test pid : " + str(os.getpid()))

    while True:
        time.sleep(100)

print("main pid : " + str(os.getpid()))
thread1 = threading.Thread(target=run_test)
thread1.start()

根据htop启动多个进程:

在此处输入图像描述

使用 PID 12004 和 12040。

但是,程序中似乎没有创建第二个进程的任何点。

第二个过程从何而来?

4

0 回答 0