'프로세스'에 해당되는 글 1건

  1. 2009.11.20 좀비 프로세스 생성하기(!)
Linux2009. 11. 20. 16:23
마지막으로 소스를 대충 보면, wait()를 하는 부분이 없네요. TestA가 daemon 형태로 re-parent한다면 상관없겠지만, 그렇지 않다면 아마 zombie 프로세스가 될 듯 합니다. zombie를 막으려면 daemon 형태로 만들거나, wait()로 child process의 return을 받아야 합니다. 그리고 이 때, SIGCHLD를 비롯, signal 처리를 하려면 pthread_sigmask() 등을 써서, signal을 원하지 않은 thread에서는 해당 시그널이 발생하지 않도록 block시켜야 합니다.

[링크 : http://kldp.org/node/103568]

All of these system calls are used to wait for state changes in a child of the calling process, and obtain information about the child whose state has changed. A state change is considered to be: the child terminated; the child was stopped by a signal; or the child was resumed by a signal. In the case of a terminated child, performing a wait allows the system to release the resources associated with the child; if a wait is not performed, then terminated the child remains in a "zombie" state (see NOTES below).

[링크 : http://linux.die.net/man/2/waitpid]

프로세스 생성하고 parent에서 waitpid 하지 않으면 좀비가 생성된다.
ps 치면 Zombie 들이 우글우글 -ㅁ-
Posted by 구차니