Tuesday, March 15, 2011

What are the process states in Unix?

As a process executes it changes state according to its circumstances. Unix processes have the following states:

Running : The process is either running or it is ready to run .

Waiting  : The process is waiting for an event or for a resource.

Stopped : The process has been stopped, usually by receiving a signal.

Zombie   : The process is dead but have not been removed from the process table.

When a program forks and the child finishes before the parent, the kernel still keeps some of its information about the child in case the parent might need it - for example, the parent may need to check the child's exit status.

To be able to get this information, the parent calls wait() In the interval between the child terminating and the parent calling wait() , the child is said to be a “zombie” state.
while using ps command, the child will have status  Z for Zombie.