- ... process1
-
A process is the object created by an operating system for (managing)
the execution of a program.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ... checker2
-
To be honest, if you wanted to do this you wouldn't use the fork
command. Instead you would probably use the exec command - but the exec
command uses fork to create the process, so fork is still the
focus of attention.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ... perhaps3
-
Actually, the use of fork above is not in the traditional
form. Traditionally
and
programmers would put the assignment
on line 10 into the selection condition on line 11 as follows.
if ((pid = fork()) > 0)
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ... (zero)!4
-
The example clearly contains a third possible scenario: the fork
command could also return a negative value. This is done when some
error occurred during process creation; for example, there is not
enough memory to create another process.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.