Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
子进程的每个退出(退出或退出)是否都向其父进程发送 SIGCHLD?如果是,那么如何创建僵尸进程?因为等待系统调用通常在 SIGCHLD 处理程序中调用。
是的,每一个死掉的进程都会导致一个 SIGCHLD 被发送给它的父进程——当然除非父进程已经将 SIGCHLD 设置为被忽略。
如果进程的父进程没有忽略 SIGCHLD,那么死去的子进程将成为僵尸,直到父进程使用waitpid()它或其变体之一来收割它。如果父母不收割死去的孩子,它将仍然是僵尸。
waitpid()