Finally, The exec() System Call
Explore the exec() system call to understand how it replaces the running program with a new executable in UNIX process virtualization. Learn its role alongside fork() and how exec() allows running different programs within a process, essential for mastering process creation APIs.
We'll cover the following...
We'll cover the following...
A final and important piece of the process creation API is the exec() system call.
Running p3.c
This system call is useful when you want to run a program that is different from the calling program. For example, calling fork() in p2.c is only useful if you want to keep running copies of the same
in the program. However, often you want to run a different program; exec() does just that (see the code below).
In this example, the child ...