Consider this code snippet:
pid_t cpid = fork();
if (cpid == -1) {
perror(\"fork\");
exit(EXIT_FAILURE);
}
if (cpid == 0) { // in child
execvp(
It depends on the behavior you want: man -s 3 exit and man _exit for more details on your system. In general I believe the _exit doesn't run functions that are registered with atexit() whereas exit does (these functions better not call exit - otherwise you get recursion).
In general I would prefer exit over _exit except for in functions registered with atexit, in those I would call _exit, if needed.