Fast understanding of orphan processes and zombie processes

Source: Internet
Author: User
Tags ming

Here's what I read about 11 years ago in Apue (Advanced Programming for UNIX environments) to understand the orphan process and the zombie process, and to make it easier to remember and explain it in a figurative way. (not necessarily accurate, but I'll post a professional explanation on Wikipedia.) )

    1. Os os like a company, the CEO of the company is the INIT process.
    2. Any child process has a parent process, just like any one has a father. This assumes that the child process is xiaoming, and the parent process is Xiaoming's father.
    3. Init process as the CEO of OS Company, is Xiao Ming's grandfather (note: Xiao Ming's father is likely to be the CEO of the Nth Generation, n>=1, here assume N=1).
    4. Any process that exits will enter the zombie state, and the resources it occupies need to be returned to the operating system (that is, the company).
    5. Xiao Ming's grandfather and Xiao Ming's father have an agreement, your son you are responsible, unless you are not in.
    6. The parent process exits before the child process exits, that is, Xiaoming is still alive, suddenly there is no father, so it became the orphan (orphan) process . In accordance with the Convention, Xiaoming (child process) was adopted by Xiao Ming's grandfather (the init process).
    7. The child process exits when the parent process is still in, that is, Xiao Ming, Xiao Ming's father is still alive. But the child process goes into a zombie state, and the parent process does nothing ( no call to wait for the child process to exit ). Iers xiaoming is not Xiao Ming's father's own bar, the next not long, the parent process also quit, that is, Xiao Ming's father also hung. So the child process (xiaoming) becomes the zombie (zombie) process . In accordance with Xiao Ming's grandfather and Xiao Ming's father's agreement, since dad don't care, that grandpa also don't care, love who.

attached: Wikipedia's explanation of the orphan process and the zombie process

1. Orphan process
In a unix-like operating system any orphaned process would be immediately adopted by the Special init system Process:t He kernel sets the parent to init. This operation is called re-parenting and occurs automatically. Even though technically the process has the ' init ' process as its parent, it's still called an orphan process since the P Rocess that originally created it no longer exists.

"Translation" in Unix-like operating systems, any father died process is adopted by a special system process named Init: the operating system kernel sets the father of the father died process to the INIT process. This operation is called Re-parenting and is automatically executed. Although technically speaking, the father died process has a father (that is, the init process), but it is still known asOrphan Process,because the parent process that initially created it is no longer there.

2. Zombie process
On Unix and Unix-like computer operating systems, a zombie process or defunct process are a process that have completed Execution (via the exit system call) but still have an entry in the process table:it are a process in the ' Terminated state ". This occurs for child processes, where the entry was still needed to allow the parent process to read its child's exit stat Us:once The exit status is read via the wait system call, the zombie's entry is removed from the process table and it is Said to is "reaped". A child process always first becomes a zombie before being removed from the resource table. In most cases, under normal system operation zombies is immediately waited on by their parent and then reaped by the Syst Em–processes that stay zombies for a long time is generally an error and cause a resource leak.

The term zombie process derives from the common definition of Zombie-an undead person. In the term's metaphor, the child process had "died" but had not yet been "reaped". Also, unlike normal processes, the KILL command has an no effect on a zombie process.

Zombie processes should not being confused with orphan Processes:an orphan process are a process that is still executing, But whose the parent has died. These does not remain as zombie processes; Instead, (like all orphaned processes) they is adopted by init (process ID 1), which waits on its children. The result is a process, a both a zombie and an orphan would be reaped automatically.

"Translation" in Unix and Unix-like operations, a zombie process (zombie or defunct) is a process that has ended running (called by the exit system), but the process also occupies a process table entry in the process table: in the signaled state.

Fast understanding of orphan processes and zombie processes

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.