Overview

In this lecture, we transition to the process control unit.

Full lecture notes on process control — Textbook readings

Processes

Process coordination

Core process control system calls

Process = image + identity + environment view

fork creates a new process

execvp runs a new program

_exit terminates this process

waitpid monitors a child process for completion

The process coordination process

Simple shell commands

$ echo foo
foo
$ sleep 5

minishell.cc

fork: Which runs first?

The uniq utility

Process hierarchy

Question

pid_t p1 = getpid();
pid_t p2 = getppid();
pid_t p3 = fork();
pid_t p4 = getpid();
pid_t p5 = getppid();
assert(???);

Some answers