title: What resources are shared between threads?
body: <p>Recently, I have been asked a question in an interview what's the difference between a process and a thread. Really, I did not know the answer. I thought for a minute and gave a very weird answer. </p>
  
  <p>Threads share the same memory, processes do not. After answering this, the interviewer gave me an evil smile and fired the following questions at me:</p>
  
  <p>Q. <strong>Do you know the segments in which a program gets divided?</strong></p>
  
  <p>My answer: <em>yep (thought it was an easy one) Stack, Data, Code, Heap</em></p>
  
  <p>Q. <strong>So, tell me: which segments do threads share?</strong></p>
  
  <p>I could not answer this and ended up in saying all of them.</p>
  
  <p>Please, can anybody present the correct and impressive answers for the difference between a process and a thread?</p>