この単純な 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 を使用。
ただし、プログラム内で 2 番目のプロセスが作成されるポイントはないようです。
2番目のプロセスはどこから来るのですか?