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.

  • 相关阅读:
    对Item中定时器的理解
    ClassLoader类加载机制&&JVM内存管理
    基于Quartz实现简单的定时发送邮件
    基于NIO的Socket通信
    1、svn架设、基本命令
    sysbench基准测试(2)——oltp.lua测试
    sysbench基准测试工具使用
    1、linux软件包管理
    7、数据结构五:sorted sets
    6、数据类型四:sets
  • 原文地址:https://www.cnblogs.com/michile/p/2890541.html
Copyright © 2011-2022 走看看