The difference between a process in Linux and exit Return and exit () gracefully

Source: Internet
Author: User

exit is a function that has parameters. void exit (int status). leave control to the system after exit executes.

Return is returned after the function has finished executing. After the return executes, give control to the calling function. return ()is the current function return. if it is in the main functionMain,naturally it will end the current process, if not, that is to return to the previous layer of the call. When multiple processes are in progress.If you sometimes want to detect whether the process exits gracefully.it is necessary to use the return value of the last process, and so on.


Return is the language level, which represents the return of the call stack, and exit is the system call level, which represents the end of a process.

In the main function, return (0) and exit (0) are the same, and the child function returns with return, while the child process exits with exit, calls a termination handler when the exit is called, and then closes all I/O streams.

This article is from the "Voice of the Heart" blog, be sure to keep this source http://ljy789.blog.51cto.com/10697684/1761947

The difference between a process in Linux and exit Return and exit () gracefully

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.