Process Control (VI)---orphan process and zombie process

Source: Internet
Author: User
Consider the following two scenarios:
  • The first type: the parent process exits before the child process.
When this happens, the child process becomes the orphan process. All orphan processes in the system will be adopted by the INIT process, and the process ID of the INIT process is always 1. When a process terminates within the system, the kernel checks to see if all processes are child processes of the terminating process, and if so, modifies the parent process ID to 1, which is adopted by the INIT process. The init process is guaranteed to wait for each child process to exit. This ensures that all processes within the system have a parent process. When an orphan process is adopted by the INIT process, the orphan process will be converted from the foreground process to the background process, which means that typing CTRL + C cannot terminate the process.
  • Second: The child process exits before the parent process
When the child process exits before the parent process, if the parent process does not use the wait or Waitpid function to wait for the child process to exit, then the child process's kernel resource (PCB) will not be recycled, and this child process is called a zombie process. Thus, if there are a lot of zombie processes, then those that can not be recycled PCB will occupy the resources of the kernel, also known as a memory leak.

Process Control (VI)---orphan process and zombie process

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.