gpu-zombie-test/scenario-1-nofix/parent.py

15 lines
398 B
Python

import subprocess
import time
import os
print(f"[Parent] PID: {os.getpid()}, PPID: {os.getppid()}")
# 자식 프로세스 spawn (GPU를 점유할 worker)
child = subprocess.Popen(["python3", "gpu_worker.py"])
print(f"[Parent] Child spawned, PID: {child.pid}")
# 부모가 wait() 없이 종료 → 자식은 고아가 됨
time.sleep(5)
print("[Parent] wait() 없이 종료합니다")
os._exit(0)