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 bash21272 pts/3    00:00:00 ps$  

Looking at the previous code, from the shell (itself a process: bash), we run or execute the ps(1) program; ps does run; it is now a process; it does its job (here printing out the processes currently alive in this terminal's session), and then politely dies, leaving us back on the shell's prompt.

A moment's reflection will reveal that ...

Get Hands-On System Programming with Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.