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.

  • 相关阅读:
    python处理url中的中文编码,以及其他编码问题
    深度学习与神经网络
    Windows下为64位的python3.4.3安装numpy
    TOP 10开源的推荐系统简介
    遗传算法
    java调用c++生成的动态和静态库时遇到的问题
    java程序(一)----HashMap同时获取键值
    Deep Learning In NLP 神经网络与词向量
    word2vec使用说明
    Spring入门_02_属性注入
  • 原文地址:https://www.cnblogs.com/michile/p/2890541.html
Copyright © 2011-2022 走看看