title: kill(pid,SIGTERM) terminates child process, although pid is of parent
body: <p>I'm learning about process allocation.</p>
  <p>Take this code block for example:</p>
  <pre><code>int main(){
      pid_t pid = fork();
      if(pid == 0){
          while(1)
              printf(&quot;Child &quot;);
      } else {
          for(int i = 0; i&lt;1000;i++)
              printf(&quot;Parent &quot;);
          kill(pid,SIGTERM);
          printf(&quot;\n%d \n &quot;, pid);
      }
  }
  </code></pre>
  <p><code>pid = 0</code> is the child process, <code>pid &gt; 0</code> is the parent process. <code>kill(pid,SIGTERM)</code> is executed by the parent with it's own <code>pid</code>, yet it kills the child and not itself. Why?</p>