Here, we study how the Unix/Linux OS, at the level of the system programmer, executes programs. First, we will teach you to understand the important exec semantics; once this is clear, you can program it, using the exec family of APIs.
Process execution
Converting a program to a process
As has been mentioned before, a program is a binary file on a storage medium; by itself, it is a dead object. To run it and thus make it come alive, into a process, we have to execute it. When you run a program from, say, the shell, it does indeed come alive and become a process.
Here is a quick example:
$ ps
PID TTY TIME CMD
3396 pts/3 00:00:00 bash
21272 pts/3 00:00:00 ps
$
Looking at the previous code, from the shell (itself...