title: Threads(PThreads) stopping execution and going into wait state
body: <p>I have been having this problem wherein my threads stop execution and go into a wait state(reason : unknown). Pseudo code is posted below followed by some explanation</p>
  
  <pre><code>int arr[1000];
  T1
  {
  tmp = arr[i];
  }
  T2
  {
  tmp=arr[i];
  }
  T3
  {
  arr[i] = value;
  }
  Main()
  {
  spawns of threads and waits for them to finish;
  }
  </code></pre>
  
  <p>So the only thing that is shared across these threads is the array, T3 writes into this array and T1,T2 read from it and use it for some purpose. 
  When I execute the program all three threads work fine and do what is required of them but when I try to run it for longer periods, after a while they stop execution and go into a wait state. The threads are still in the process mix but in less idle state. I do not know why this is happening and would greatly appreciate if someone can provide any useful pointers as to how I can find a resolution to this problem.</p>