質問

Hypothetically, let's say main() function creates second process calling fork() and let's say this new process starts creating its own children by function makeChildren(), one million in loop, crazy user. Fork() fails, makeChildren() returns error. How to get rid off these new processes that have been already created? Can I use killpg(getpgrp(), SIGKILL) ??? If I understand it right each process in this scenario has same group ID, no? When I use killpg(getpgrp(), SIGKILL) program will terminate immediately, am I right? Do I have to use setpgid()? I want to kill this zombies and in main release shared memory, semaphores and so on ... Thank you for any explanation.

役に立ちましたか?

解決

If the parent process terminates, its children will be reassigned to the init process. It will wait for them so they shouldn't become zombies.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top