I fork() into process X and Y, afterwards Y forks() again into itself and process Z multiple times.
Now process Y is some kind of \"listene
Your question does a terrific job of making the actual problem hard to understand. Still, I believe I can discern the following: "I want to get rid of the zombies". Well, don't we all.
There are multiple ways of doing this:
Y ignore SIGCHLD. forked children will not turn into zombies when they dieY periodically reap (wait) for any childrenIt's your choice which one you use, but it seems to me the first is what you want.