title: Unique processes and threads in c
body: <p>For the program below:</p>
  
  <pre><code>int main() {
  Pid_t pid1, pid2;
  Pid1 = fork();
  pid2 = fork();
  if (pid1 == 0) { /* child process */
  thread_create(. . .);
  }
  if (pid2 == 0) { /* child process */
  pthread_create(. . .);
  }
  fork();
  }
  </code></pre>
  
  <p>a.How many unique processes are created? 
  b. How many unique threads are created? </p>
  
  <p>Our class has been discussing this for two days. We are told that it is 2 unique threads. However when I replace the pthread_create with a print I am getting more than two. I get this output</p>
  
  <p>Thread 2: 1855 0
  Thread 1: 0 1859
  Thread 1: 0 0
  Thread 2: 0 0
  Where Thread 1/2 shows the if statments and pid1 pid2 is printed.</p>
  
  <p>So why is it 2? Can you provide an explanation we can show in class?</p>