Reclaim process user space resource exit () function _ exit () function atexit () function on_exit () function, _ exitatexitAbstract:This article describes how to terminate a process and how to use the exit () function to terminate the process and
Abstract:This article describes how to terminate a process and how to use the exit () function to terminate the process and reclaim the user space resources of the process. It analyzes the exit () function and the _ exit () function, difference in
Process 1 is the main first process init of all processes
How to view the process: PS uax
# Include # Include # Include # Include
Int main (){Pid_t PID;Int A = 8;Printf ("current process ID: % d \ n", getpid ());PID = fork ();If (pid> 0) // What
The Dameon process is also called the Daemon, in general he has the following 2 characteristics :1. The life cycle is very long, once started, generally will not terminate, until the system is launched, but the Dameon process can be stopped or send
Now I've written a Hello World program to take a look at it:
Filename:main.c
#include
int main (void)
{
printf ("Hello wolrd!\n");
return (-);
}
Compile execution: gcc main.c &&/a.out
Now let's take a look at the return
Objectives of this section:
Zombie Process
SIGCHLD
Wait
Waitpid
1. botnets
When a child process stops running before the parent process, the association between the child process and its parent process still ends until the parent process
What are the differences between exit (0), exit (1), and exit (-1? When the process ends, the return value to the system is different. If your process is user, run echo $? You can see that the return value of your process is the value you set in the
The exit and exit status codes exit are used to end a script, just like in C. it also returns a value, which is passed to the parent process of the script. The parent process uses this value for further processing. each command returns an exit
The process has the following five normal termination methods:
(1) execute the return statement in the main function. This is equivalent to calling exit.
(2) Call the exit function. This function is defined by iso c. Its operations include calling
Exit and exit Status Codes
Exit is used to end a script, just like in C. it also returns a value, which is passed to the parent process of the script. The parent process uses this value for further processing.
Each command returns an exit status
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.