Spawn

This lesson discusses the alternative to forking processes, which is spawning them.

We'll cover the following...

Spawn

In the previous section, we discussed how we could create processes using fork as the start method. However, fork comes with shortcomings of its own and may not be what we want. The next option available to create a process is the spawn method.

exec system call

In order to understand spawn, we'll examine the exec family of system calls. When you issue an ls or a find command in your terminal, the shell first forks itself and then invokes one of the variants of the exec family of system calls. Briefly, an exec call transforms the calling process into another. The program in the calling process is replaced with another program and is run from the entry point. Realize the distinction between a program and a process as it matters in this context. The program is just a set of instructions and data that is used to initialize a ...