title: Why multiple clone system calls called for single go subroutine?
body: <p>I created small sample program to check sub-routine system call.</p>
  
  <pre><code>package main
  
  func print() {
  }
  
  func main() {
      go print()
  }
  </code></pre>
  
  <p><strong>Straces of go subroutine</strong></p>
  
  <pre><code>clone(child_stack=0xc000044000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM) = 27010
  clone(child_stack=0xc000046000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM) = 27011
  clone(child_stack=0xc000040000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM) = 27012
  futex(0x4c24a8, FUTEX_WAIT_PRIVATE, 0, NULL) = 0
  futex(0xc000034848, FUTEX_WAKE_PRIVATE, 1) = 1
  exit_group(0)                           = ?
  </code></pre>
  
  <p>It is observed that three times clone system call called for single subroutine but stack size is small as go is claiming. Can you please let me know why three clone system call called for single subroutine.</p>
  
  <p>In the similar manner when creating a pthread single time clone system call called. but stack size is big.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;unistd.h&gt; //Header file for sleep(). man 3 sleep for details.
  #include &lt;pthread.h&gt;
  
  void *myThreadFun(void *vargp)
  {
          return NULL;
  }
  
  int main()
  {
          pthread_t thread_id;
          pthread_create(&amp;thread_id, NULL, myThreadFun, NULL);
          pthread_join(thread_id, NULL);
          exit(0);
  }
  </code></pre>
  
  <p><strong>Straces of pthread</strong> </p>
  
  <pre><code>clone(child_stack=0x7fb49d960ff0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARET_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7fb49d9619d0, tls=0x7fb49d961700, child_tidptr=0x7fb49d9619d0) = 27370
  futex(0x7fb49d9619d0, FUTEX_WAIT, 27370, NULL) = -1 EAGAIN (Resource temporarily unavailable)
  exit_group(0) = ?
  </code></pre>
  
  <p>Why multiple clone system calls called for single go subroutine? because in the program only single sub-routine was created like single pthread in second program of C language. For what purpose other two clone called? </p>