Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.


How do you create a zombie process?


 
Thread Tools Search this Thread
# 1  
How do you create a zombie process?

I'm very new to UNIX, so I need some help please.

How do I create a zombie process with just basic UNIX commands (no script, C, PERL, etc)? Please give an example. Thanks.
# 2  
you don't create zombie processes. zombie is a process state. the process does not actually exist. Read up on what a zombie process is and then you will understand how to do it. I don't understand why a UNIX newbie would be trying to do this though.
# 3  
I know zombie is a process state, but I'm trying to create one so I can see how it looks like.
# 4  
this sounds cool.
so teiji.
did u get a chance to see a ZOMBIE process?
If yes, please reply me your work and if possible an example !!!
# 5  
Hello,

A ZOMBIE program is NOT something you want in your system.

It is a process that crashed and which is robbing memory space and/or cpu cycles.
They are detached from any terminals or processes that lauched it in the first place and are hard to kill. sometime only a reboot can get rid of it.

However, if you want to launch a program in the background there is 2 options to do so.

A) /usr/bin/your program &
B) nohup /usr/bin/your program

The differences lies in what your program do when you log out.
A) The program terminates upon login out
B) The program keep on running and only a kill or fuser command will stop it.
# 6  
If you're curious and want to see how a zombie looks like you can create a zombie process with this c program:

Code:
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

int main ()
{
  pid_t child_pid;

  child_pid = fork ();
  if (child_pid > 0) {
    sleep (60);
  }
  else {
    exit (0);
  }
  return 0;
}

Save it as zombie.c, compile it with:

Code:
cc zombie.c -o zombie

and run it with:

Code:
./zombie

Now check the output of this command (within 1 minute) in another window:

Code:
ps -e -o pid,ppid,stat,cmd

The child process is marked as <defunct>, and its status code is Z, for zombie.

When the program exits, the child process is inherited by init. This process should cleans up the zombie proces automatically.


Regards
# 7  
Quote:
Originally Posted by yvant
It is a process that crashed and which is robbing memory space and/or cpu cycles.
this is an incorrect statement. a zombie process is not taking up system resources. the process does not actually exist anymore. the entry is left in the process table until the parent reads its exit status. The only resource used is the slot in the process table.
 

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
zombie process
sboots
Is there an equivilant to the preap command in AIX that would allow me to get rid of a zombie process. I am new to AIX, moving over from Solaris and in the past I have been able to preap the pid on the defunct process to clean them up. I have looked around and the best I can see is that it may...... AIX
3
AIX
Zombie process
ruben.rodrigues
Hi I need help because I don't know if it is possible to add a find inside a cat. like I have a file with the pid of the process that use to became zombie. And I have the same pid stored in the var (pid1) now, I have no clue how to check if the the find finds the pid or even if it's...... Shell Programming and Scripting
2
Shell Programming and Scripting
zombie process
jeenat
Hi What is the command to find only the zombie processes?? How to write the code in C to fetch the no. of zombie processes?? Thanx... Linux
5
Linux
Zombie process
swhitney
I would like to create a zombie process so that I can test monitoring software functionality. Any techniques?... UNIX for Advanced & Expert Users
2
UNIX for Advanced & Expert Users
Zombie process
orca
How do i kill a zombie process. Is it that only root can kill a zombie process.... UNIX for Dummies Questions & Answers
8
UNIX for Dummies Questions & Answers

Featured Tech Videos