Unix Process Control

Unix Internals:

A new process is created because an existing process makes an exact copy of itself. This child process has the same environment as its parent, only the process ID number is different. This procedure is called forking.

After the forking process, the address space of the child process is overwritten with the new process data. This is done through an exec call to the system.

The fork-and-exec mechanism thus switches an old command with a new, while the environment in which the new program is executed remains the same, including configuration of input and output devices, environment variables and priority. This mechanism is used to create all UNIX processes, so it also applies to the Linux operating system. Even the first process, init, with process ID 1, is forked during the boot procedure in the so-called bootstrapping procedure.

This scheme illustrates the fork-and-exec mechanism. The process ID changes after the fork procedure:

  • parent : read command ---->fork()---> wait(childreturnvalue) ---> receive child status

    child: -------> execvp () ---- exit (return)

[root@ipc4 uulp]# pstree -aG







├─dbus-daemon-1 --system













├─gdm-binary -nodaemon

├─gpm -m /dev/input/mice -t imps2






├─klogd -x








├─mingetty tty1

├─mingetty tty2

├─mingetty tty3

├─mingetty tty4

├─mingetty tty5

├─mingetty tty6

├─mysqld_safe /usr/bin/mysqld_safe --datadir=/var/lib/mysql...

└─mysqld --basedir=/ --datadir=/var/lib/mysql ...

├─named -u named -t /var/named/chroot









├─ntpd -u ntp:ntp -p /var/run/ntpd.pid -g















└─sesh /bin/su -

└─su -










└─pstree -aG

├─syslogd -m 0


├─vmware-guestd --background /var/run/vmware-guestd.pid

├─xfs -droppriv -daemon

├─xinetd -stayalive -pidfile /var/run/xinetd.pid