"Taking a LiveFire Labs' course is an excellent way to learn
Linux/Unix. The lessons are well thought out, the material is
explained thoroughly, and you get to perform exercises on a real
Linux/Unix box. It was money well spent."
Ray S.
Pembrook Pines, Florida
LiveFire Labs' UNIX and Linux Operating System Fundamentals
course was very enjoyable. Although I regularly used UNIX systems
for 16 years, I haven't done so since 2000. This course was a
great refresher. The exercises were fun and helped me gain a real
feel for working with UNIX/Linux OS. Thanks very much!"
Ming Sabourin
Senior Technical Writer
Nuance Communications, Inc.
Montréal, Canada
Read more student testimonials...
Receive UNIX Tips, Tricks, and Shell Scripts by Email
LiveFire Labs' UNIX Tip,
Trick, or Shell Script of the Week
UNIX Process Management - Part II (Parent-Child, Fork-and-Exec,
Daemons)
UNIX Parent and Child Processes
Minus one exception, every process on a UNIX system has a parent
process. When a parent process spawns another process, this new
process is called a child process.
A child process is created every time you run a command or program
from the command line. While the child process is doing its work, the
parent process will go to sleep. Once the child process has completed
its work, it will terminate (die) and the parent process will wake up
and go back to work. When the child process dies, the command prompt
will be returned to you ready to accept your next command.
All of the processes running on a system can be traced back to a
single system process. The name of this process is init and has a
process ID (PID) of 1. Like the file system, the process structure of
a system is also hierarchical, and the init process is equivalent to
the file system's root directory (/). The init process is started by
the operating system when the system is booted.
UNIX Fork-and-Exec
The spawning of a new child process is called forking a process
because fork is the name of the operating system routine that creates
the new process. When a parent process forks the new process, the new
process will initially be an exact copy of the parent.
Exec is the operating system routine that will overwrite the existing
image passed from the parent to the child with the new command or
program. This entire process of creating a child process from a parent
process is called Fork-and-Exec.
UNIX Daemons
You were introduced to the telnet daemon when you first connected to
the system. A daemon is a server process that is typically started
when the system is booted, and will continuously run in the background
waiting until its service is needed.
Need a simple script to monitor and restart your system processes automatically?
See ProcMonUX - a Simple Lightweight Process Monitor Script with Alerts, Restart and Logging for more info. It works with both UNIX and Linux...and it's FREE!
Read the PREV article in this series -
UNIX
Process Management - Part I