title: Process tree / Number of processes for fork()
body: <p>I want to know the number of processes created for the below code. I got to know from my instructor the answer is 41 but I am unable to follow the same. Please explain the same with a process tree.</p>
  <pre><code>  void main() {
      for (i=0;i&lt;2;i++){
          fork();
          if(!fork()) {
              execl(&quot;/bin/ls&quot;,&quot;ls&quot;,NULL);
              fork();
          }
          fork();
       }
       fork();
    }
  </code></pre>