title: What is the difference between exit() and exit_group()
body: <p>What is the difference between <a href="http://linux.die.net/man/2/exit" rel="noreferrer">exit()</a> and <a href="http://linux.die.net/man/2/exit_group" rel="noreferrer">exit_group()</a>. Any process that has multiple threads should use exit_group instead of exit?</p>
  
  <p>To answer the question <code>why do you ask</code> - we are having an process that has around forty threads. When a thread is locked up, we automatically exit the process and then restart the process. And we print the backtrace of the thread that was locked up. We wanted to know whether calling exit in this case is any different from exit_group.</p>
  
  <p><code>From the docs: This system call is equivalent to exit(2) except that it terminates not only the calling thread, but all threads in the calling process's thread group</code> - However, what is the difference between exiting the process and exiting all the threads. Isn't exiting process == exiting all the threads.</p>