a process terminated by one of the following 5 reasons --themain function called return; -- Call the Exit function,-- Call the _exit function --Call the abort function --to be terminated by a signal. (Kill function) The first three reasons are normal termination, the latter two are abnormal termination. Regardless of why the process terminates, the final execution of the same kernel code, closing open files, freeing up memory resources, and other cleanup work.
Exit Function int exit (int status); Exit causes the program to terminate normally. and return to the parent process status (status) Exit parameter is the status code returned to the parent process is similar to calling return and exit in the main function, but in the child function, return is to exit the current function, exit is to exit the current process
Abort function void abort (void); Abort causes the program to terminate abort also allows the program to produce core, which is the file when most debugger user parser crashes. Although any open files are closed, abort is still a rude call and should be used as a last resort. For example, when you encounter a very serious memory shortage of such errors, can not be used in the process of the program to use.
Kill function int Kill (pid_t pid,int sig); Exit,abort is used to kill the process itself. The Kill function is used to kill another process. Parameter PID specifies a process to kill, and the sig is the new number to send, and this chapter is about killing a process, so just pay attention to sigkill a signal. For example: Kill (2056, SIGKILL);
Linux End Process