A process is defined as the minimum entity which can execute. A process is a program in execution. Each process has some code space and some data space. Code space consists of the instructions of the process and data space consists of the data used by the process, like variables.
UNIX allows a process to create more processes by a system call known as fork(). Most processes have a parent. A hierarchy of parent-child process exists in the UNIX system. The child process starts execution from the next instruction of the parent process. This next instruction is stored in the program counter. The child process inherits the code space from its parent process.
Whenever there is some system call, and UNIX returns a negative value, it indicates occurrence of errors.
pid=fork()
Here fork returns child id, the process id of the child created, to the parent process, and returns 0 to the child process. Process id is always unsigned int. UNIX system supoprts two system calls for returning process id - getpid() - for the id of the calling process, and getppid() - for the id of the parent of calling process.
Calling fork() 'n' times will result in '2n' processes in the system.
Calling fork() in an infinite loop will result in a Fork Bomb.