Linux End Process

Source: Internet
Author: User
Tags exit in

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.