in reply to Create zombies on purpose

Yes, fork processes and don't wait on them in the parent.

#!/usr/bin/perl fork or exit for 1..100; <>;

Replies are listed 'Best First'.
Re^2: Create zombies on purpose
by happy.barney (Friar) on Mar 17, 2011 at 15:13 UTC
    note: forked processes should exit and parent cannot.
    perl -e 'fork || exit for 1 .. shift; <>' 5
      Of course, I was doing it right, but when perl exits, the Zombies disappears. So I was wrong. Thank you! Any way of leaving the zombies after the parent exits?
        Simplified: if process exits, all its children are turned to be children of process 1 (init) and that it will wait.
        You can for example replace <> with kill STOP => $$ but than it will be good to have possibility to terminate that process.
        No, because they are not zombies then, they are orphans.

        Anyway, a zombie is a process that has finished - it is only there to allow the parent to pick-up its exit code, there is almost nothing left of the original process (if memory serves me right, a zombie is only a couple of pages on Linux).