Mimic the pipe operator in the shell:
ls | cat
./pipe ls cat
fork
splits the current processwait
waits for the other forkexec
executes another processfork
fork()
will create another process—exact same copy including the execution statefork()
0
, we’re in the child process0
, in the parent process0
, errorexec
execve(pathname, argv, environmentvars)