The general calling sequence of system calls
If a single program has two distinct execution paths/sequences, then the
parent and child may run different parts of the same program. Typically the
parent will want to know when the child terminates.
|
The typical sequence of events is:
- the parent process fork()s a new child process.
- the parent waits for the child's termination,
calling the blocking function
wait( &status ).
- [optionally] the child process replaces details of its
program (code) and data (variables)
by calling the execve() function.
- the child calls exit(value),
with an integer value to represent its success
or failure. By convention,
zero (= EXIT_SUCCESS) indicates successful execution,
non-zero otherwise.
- the child's value given to exit() is written
by the operating system to the parent's status.
|
CITS2002 Systems Programming, Lecture 9, p3, 19th August 2024.
|