Why? Motivating the API

This lesson focuses on what you can achieve through the combination of the system calls you just learned.

We'll cover the following

Shell

Of course, one big question you might have: why would we build such an odd interface to what should be the simple act of creating a new process? Well, as it turns out, the separation of fork() and exec() is essential in building a UNIX shell, because it lets the shell run code after the call to fork() but before the call to exec(); this code can alter the environment of the about-to-be-run program, and thus enables a variety of interesting features to be readily built.

The shell is just a user program.

Get hands-on with 1200+ tech skills courses.