title: Correct usage of fork, wait, exit, etc
body: <p>I have this problem to solve that I have no idea how to do it because there's only a few system calls we can use to solve it and I don't see how they are helpful for the situation.</p>
  
  <p><strong>The Exercise:</strong><br>
  I have matrix with size [10][1000000] with integers and for each line I create a new process with fork(). The idea of each process is to go through all the numbers for that specific line and find a specific number then print a message about it. This was the first step of the problem and it's done. The second step is to print the total of occurrences of that number on each line <strong>by order</strong>. And in the end, the grand total of occurrences of that number.</p>
  
  <p><strong>The Calls:</strong><br>
  The system calls I can use are described like this in the document for this exercise:</p>
  
  <ul>
  <li><code>pid_t fork(void);</code></li>
  <li><code>void exit(int status);</code></li>
  <li><code>pid_t wait(int *status);</code></li>
  <li><code>pid_t waitpid(pid_t pid, int *status, int options);</code></li>
  </ul>
  
  <p><strong>The Problem:</strong><br>
  I have no idea how to do it because the <code>exit()</code> call only allows me to pass a number below 256, what if the number of occurrences is larger than this number? How shall I return such a number?</p>
  
  <p><strong>Another Problem:</strong><br>
  I don't exactly understand the difference between <code>wait()</code> and <code>waitpid()</code> and how/where to use one over the other. Besides the man pages, are there any more documentation where I can see code examples and such to understand them better? Or can someone explain me the differences and provide a basic example demonstrating such differences?</p>