zoukankan      html  css  js  c++  java
  • advacing lnux program zombie process [copy]

    A zombie processis a process that has terminated but has not been cleaned up yet. It
    is the responsibility of the parent process to clean up its zombie children.The wait
    functions do this, too, so it’s not necessary to track whether your child process is still
    executing before waiting for it. Suppose, for instance, that a program forks a child
    process, performs some other computations, and then calls wait. If the child process
    has not terminated at that point, the parent process will block in the waitcall until the
    child process finishes. If the child process finishes before the parent process calls wait,
    the child process becomes a zombie.When the parent process calls wait, the zombie
    child’s termination status is extracted, the child process is deleted, and the waitcall
    returns immediately.
    What happens if the parent does not clean up its children? They stay around in the
    system, as zombie processes.The program in Listing 3.6 forks a child process, which
    terminates immediately and then goes to sleep for a minute, without ever cleaning up
    the child process.

    What happens when the main make-zombieprogram ends when the parent process
    exits, without ever calling wait? Does the zombie process stay around? No—try
    running psagain, and note that both of the make-zombieprocesses are gone.When a
    program exits, its children are inherited by a special process, the initprogram, which
    always runs with process ID of 1 (it’s the first process started when Linux boots).The
    initprocess automatically cleans up any zombie child processes that it inherits.

  • 相关阅读:
    WPF ViewModel 调用任意前台控件的方法
    xxxx
    modelsim一些error(warning)的原因
    [verilog] inout端口处理
    [c语言]指针数组和数组指针
    电机控制术语
    MAC和PHY关系
    IAR map文件说明
    [corterm3]汇编语法
    TI 2802x系列中断系统及应用
  • 原文地址:https://www.cnblogs.com/michile/p/2890541.html
Copyright © 2011-2022 走看看