ps aux | grep 'Z'
或 ps -eo pid,ppid,state,cmd | grep 'Z'
查看狀態為 Z
的進程。top
或 htop
實時監控進程狀態,篩選僵尸進程。ps -o ppid= -p <僵尸進程PID>
。SIGCHLD
信號,通知其回收子進程資源:kill -s SIGCHLD <父進程PID>
。kill -9 <父進程PID>
,避免影響系統穩定性。wait()
或 waitpid()
系統調用回收子進程資源。systemd
等現代服務管理器,自動處理子進程生命周期。cron
定時任務運行檢測腳本,自動清理異常進程。kill -9
僵尸進程本身,因其已終止,無法被殺死。參考來源:[1,2,3,5,6,7,8,9,10,11]