diff --git a/exec.c b/exec.c index 98429e5..17944a1 100644 --- a/exec.c +++ b/exec.c @@ -14,10 +14,13 @@ int main() { // When the child process returns from `fork`, the value assigned to `pid` // will be 0. In the parent process, `pid` will be the process ID (a non-0 - // number) of the child process. + // number) of the child process. It is important to note that the process ID + // of the child isn't actually 0. The call to `fork` only returns 0 to + // allow code to determine if it is the child. if(pid == 0) { - // This call to `exec` will only be run by the child process. This is - // because `exec` replaces the process' instructions with the instructions + // Since this block only executes if `pid` is 0, the call to `execvp` will + // only be run by the child process. This is done because the `exec` family + // of functions replace the process' instructions with the instructions // found in `cmdline[0]` (in this case, `echo`). The `v` in `execvp` means // vector, which in this case refers to the array `cmdline`. The `p` means // path, indicating that it will search all of the directories found in the