If the child process ends before the parent process, the parent process calls the wait () function and does not call the wait () function to produce two different results: -- if the parent process does not call wait () and waitpid () function, the
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
If a child process is preceded by a parent process, the wait () function is invoked by the parent process and the wait () function is not invoked to produce two different results:--> If the parent process does not invoke the wait () and the Waitpid (
1. Concept1, orphan process: A parent process exits, and one or more of its child processes are still running, then those child processes will become orphans. The orphan process will be adopted by the INIT process (process number 1) to ensure that
After a parent process creates a child process through fork, the execution sequence of the parent process and child process cannot be controlled. you can use vfork to create or the parent process to call the wait function.
For the difference between
(Switch) Linux Process Control-Wait ()
# Include /* define the pid_t type */# Include Pid_t wait (int * Status)
Once a process calls wait, it immediately blocks itself. Wait automatically analyzes whether a sub-process of the current
I. botnets
When a child process exits, the kernel sends a sigchld signal to the parent process. The exit of the child process is an asynchronous event (the child process can be terminated at any time when the parent process is running)When a child
Zombie Process: The child process terminated, but the parent process did not reclaim the resource PCB for the child process. Make it a zombie processOrphan process: The parent process ends with the child process, which causes the child process to
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
Linux Process understanding and practice (4) wait function processing botnetsWait background
When a child process exits, the kernel sends a SIGCHLD signal to the parent process. The exit of the child process is an asynchronous event (the child
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.