killing parent process doesn't kill child

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I have a question.
Studying processes management I observed a strange behavior, on a CentOS 7.
I know that killing a parent process, the child processes are killed also. But not in the following case. I ran the command dd, just for example:



[root@server2 ~]# dd if=/dev/zero of=/dev/null &
[1] 1756

[root@server2 ~]# ps fax | grep -B2 dd
1737 pts/2 S 0:00 _ su -
1741 pts/2 S 0:00 _ -bash
1756 pts/2 R 1:18 _ dd if=/dev/zero of=/dev/null


After that I tried to kill (with SIGKILL signal) the parent process, that is the bash, but this action doesn't kill the dd process:



[root@server2 ~]# kill -9 1741
Killed
[user@server2 ~]#


The shell terminates but as you can see in the top command output, the dd process is still working:



PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 
1756 root 20 0 107948 612 512 R 99.9 0.1 10:06.98 dd


Do you have any idea about it please? Thanks







share|improve this question























    up vote
    1
    down vote

    favorite












    I have a question.
    Studying processes management I observed a strange behavior, on a CentOS 7.
    I know that killing a parent process, the child processes are killed also. But not in the following case. I ran the command dd, just for example:



    [root@server2 ~]# dd if=/dev/zero of=/dev/null &
    [1] 1756

    [root@server2 ~]# ps fax | grep -B2 dd
    1737 pts/2 S 0:00 _ su -
    1741 pts/2 S 0:00 _ -bash
    1756 pts/2 R 1:18 _ dd if=/dev/zero of=/dev/null


    After that I tried to kill (with SIGKILL signal) the parent process, that is the bash, but this action doesn't kill the dd process:



    [root@server2 ~]# kill -9 1741
    Killed
    [user@server2 ~]#


    The shell terminates but as you can see in the top command output, the dd process is still working:



    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 
    1756 root 20 0 107948 612 512 R 99.9 0.1 10:06.98 dd


    Do you have any idea about it please? Thanks







    share|improve this question





















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have a question.
      Studying processes management I observed a strange behavior, on a CentOS 7.
      I know that killing a parent process, the child processes are killed also. But not in the following case. I ran the command dd, just for example:



      [root@server2 ~]# dd if=/dev/zero of=/dev/null &
      [1] 1756

      [root@server2 ~]# ps fax | grep -B2 dd
      1737 pts/2 S 0:00 _ su -
      1741 pts/2 S 0:00 _ -bash
      1756 pts/2 R 1:18 _ dd if=/dev/zero of=/dev/null


      After that I tried to kill (with SIGKILL signal) the parent process, that is the bash, but this action doesn't kill the dd process:



      [root@server2 ~]# kill -9 1741
      Killed
      [user@server2 ~]#


      The shell terminates but as you can see in the top command output, the dd process is still working:



      PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 
      1756 root 20 0 107948 612 512 R 99.9 0.1 10:06.98 dd


      Do you have any idea about it please? Thanks







      share|improve this question











      I have a question.
      Studying processes management I observed a strange behavior, on a CentOS 7.
      I know that killing a parent process, the child processes are killed also. But not in the following case. I ran the command dd, just for example:



      [root@server2 ~]# dd if=/dev/zero of=/dev/null &
      [1] 1756

      [root@server2 ~]# ps fax | grep -B2 dd
      1737 pts/2 S 0:00 _ su -
      1741 pts/2 S 0:00 _ -bash
      1756 pts/2 R 1:18 _ dd if=/dev/zero of=/dev/null


      After that I tried to kill (with SIGKILL signal) the parent process, that is the bash, but this action doesn't kill the dd process:



      [root@server2 ~]# kill -9 1741
      Killed
      [user@server2 ~]#


      The shell terminates but as you can see in the top command output, the dd process is still working:



      PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 
      1756 root 20 0 107948 612 512 R 99.9 0.1 10:06.98 dd


      Do you have any idea about it please? Thanks









      share|improve this question










      share|improve this question




      share|improve this question









      asked Apr 29 at 7:51









      intore

      746




      746




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          By default killing a parent process does not kill the children processes.



          I suggest you look for other questions about how to kill both the parent and child using the process group (a negative PID).



          A good answer about how to do this in detail can be found at Process descendants






          share|improve this answer





















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );








             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f440691%2fkilling-parent-process-doesnt-kill-child%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            3
            down vote



            accepted










            By default killing a parent process does not kill the children processes.



            I suggest you look for other questions about how to kill both the parent and child using the process group (a negative PID).



            A good answer about how to do this in detail can be found at Process descendants






            share|improve this answer

























              up vote
              3
              down vote



              accepted










              By default killing a parent process does not kill the children processes.



              I suggest you look for other questions about how to kill both the parent and child using the process group (a negative PID).



              A good answer about how to do this in detail can be found at Process descendants






              share|improve this answer























                up vote
                3
                down vote



                accepted







                up vote
                3
                down vote



                accepted






                By default killing a parent process does not kill the children processes.



                I suggest you look for other questions about how to kill both the parent and child using the process group (a negative PID).



                A good answer about how to do this in detail can be found at Process descendants






                share|improve this answer













                By default killing a parent process does not kill the children processes.



                I suggest you look for other questions about how to kill both the parent and child using the process group (a negative PID).



                A good answer about how to do this in detail can be found at Process descendants







                share|improve this answer













                share|improve this answer



                share|improve this answer











                answered Apr 29 at 9:38









                Craig Small

                47626




                47626






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f440691%2fkilling-parent-process-doesnt-kill-child%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?