initFork creates the process tree from the most common ancestor (PID = 1). Continues running until shutdown.
Creates a new child process, a duplicate of the current executable image.
clone allows for partial copying.execl, execlp, execle, execv, execvp, execvpe for different parametersargc: number of command line argumentsargv char* string array. Each element in in argv[] is a character string. arg[0] is always the program name.execl replaces currently executing process image with a new one.
int main() {
execl( "/bin/ls", "ls", "-al", NULL);
} // executes "ls -al"
wait(int *status) returns the PID of the terminated child process in the least significant byte of *status.
waitid() suspends until the child specified by the PID argument changes state.
Scheduling Running –> Ready: When the OS decides you are taking up too much CPU time, you will be sent back to the ready queue
result from main() implicitly calls exit(result) (open files are also flushed automatically)exits it immediately becomes a zombie as it still has a PCB in the process table.wait to read the child process’ exit status, it is “reaped” and removed.
init process (which is the first process that boots in a Unix system) becomes the pseudo-parent of child.
wait() called by init periodically cleans up.