PAUSE
BOTCLEAN
ENCORE5
CLEAN
ENCORE
BOX
ILLUSTRATION
GO
A process is an instance of a program in execution.
Assume that Process 1 is a program called A,
Program A
Process 1 -------->
When program A issues a fork(), a parent and a child process are created.
Program A fork()
Process 1 --------> V -------->
| parent
|
|
| Program A
Process 2 -------------
child
Normally, the parent process issues a wait() ...
Program A fork wait
Process 1 --------> V -------->||
| parent
|
|
| Program A
Process 2 -------------
child
... and the child issues an exec of a new program, B:
Program A fork wait
Process 1 --------> V -------->||
| parent
|
|
| Program A
Process 2 -------------[ exec B]
child
At this point, the parent of program A is asleep and B is running.
Program A fork wait
Process 1 --------> V -------->||- : - : - : - : - : -
| parent (sleeping)
|
|
| Program A Program B
Process 2 ------------->[ exec B]->->->->->->
child running
Finally, program B executes exit() and
the return signal is sent to the parent program A
and then program A continues on its course!
Program A fork wait A
Process 1 --------> V -------->||- : - : - : - : - : - ->>----->
| parent (sleeping) ^
| |
| ^
| Program A Program B :
Process 2 ------------->[ exec B]----------->X
child exit