This recipe will show how to start a new process programmatically. The C++ standard does not include any support for processes, so the Linux native implementation will be used. Being able to manage processes in a program is an important skill, and this recipe will teach you the fundamental concepts of processes, the process identifier (PID), the parent PID, and the system calls needed.
Starting a new process
How to do it...
This recipe will show how to start a child process and how to make the parent process wait for the child to finish by using Linux system calls. Two different techniques shall be shown: the first, where the parent just forks the child; and the second, where the child process uses the execl system call...