Distributed Networks Distributed Networks





Shell Processes   «Prev  Next»
Lesson 5 Parent and child processes
Objective Relationship between Parent and Child Processes

Relationship between Parent and Child Processes

When you run a program in your shell, a process is created. This new process is called a child process of the shell. The originating process (the shell from which you ran the command) is called the parent process of the child. When you run a new shell, you are creating a child process under the originating shell. Examine the SlideShow below to see an example of new processes being created as shells are run from the command line.



Shell Scripting BibleShell Scripting Bible


The ps –f command

The command ps –f lists all of the processes you are currently running. The–f displays a full list of information. This information includes the PID of the parent process, which is referred to as the PPID in the ps command output. Look at the sample ps –f command below. It reflects the processes created in the SlideShow above. Connecting lines are included in the command below to point out the relationship between the PID and PPID numbers. These lines are not normally part of the output, they are just used here for clarification.
parentchild_010gr
In the listing above, the /bin/ksh process (PID 3723) was started from the /bin/sh process (PID 3707), so 3707 is listed as the PPID of 3723. The /bin/csh process (PID 3725) was started from the /bin/ksh process (PID 3723), so 3725 is listed as the PPID of 3725.
The next lesson examines three different techniques for running a shell script.