Process management system calls in POSIX: fork, waitpid, execve, exit

Here are the process management system calls in POSIX:

pid = fork( ): It is used for creating a child process which is the duplicate of parent. It returns a value zero in child proecess and child’s PID (Process Identifier) in parent.

pid = waitpid(pid, &statloc, options): It is used by the parent process to wait for a child process to finish and terminate. After completion of waitpid, address pointed by statloc is set to exit status of child process. options parameter is used for setting up different options for waitpid.

s = execve(name, argv, environp): It is used for replacing core image of a process. User command is executed by the child process by using execve system call. execve replaces the core image by the file named in name parameter. Here, name parameter specifies the file name to be executed, argv is a pointer to argumnet array, and environp is a pointer to the environment array.

exit( status): It is used for terminating process execution and for returning status.

Leave a Reply