Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Create zombies on purpose

by eddor1614 (Beadle)
on Mar 17, 2011 at 14:54 UTC ( #893776=perlquestion: print w/ replies, xml ) Need Help??
eddor1614 has asked for the wisdom of the Perl Monks concerning the following question:

Hello I need to create Zombie processes to test a monitoring tool. Is there an easy? Thanks

Comment on Create zombies on purpose
Re: Create zombies on purpose
by Eliya (Vicar) on Mar 17, 2011 at 15:00 UTC

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

    #!/usr/bin/perl fork or exit for 1..100; <>;
      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?
Re: Create zombies on purpose
by sundialsvc4 (Monsignor) on Mar 17, 2011 at 20:04 UTC

    A “zombie” process is always the immediate child of the parent that created it, which exists only so that the parent can reap it and thus collect its final status.   Many operating systems impose limits on the number of zombies that may exist, for very obvious (denial-of-service) reasons.

    When a parent dies, leaving orphans behind, those orphans are immediately reaped by the init process.

    Your monitoring tool doesn’t have to test the operating system, nor should it challenge it.   You may need to verify that the tool does, in fact, detect whatever conditions you want it to detect, in whatever situations you need for it to be able to do so, but you should not need to “stress test” this case, and I recommend that it would be both unreliable and pointless to try.

Re: Create zombies on purpose
by zentara (Archbishop) on Mar 18, 2011 at 15:09 UTC
    I represent The Society for Prevention of Cruelty to Zombies. Do you have enough human brains for your zombie creations to eat? A hungry zombie is a terrible thing.

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://893776]
Approved by chrestomanci
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2014-08-29 04:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (275 votes), past polls