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