title: python subprocess
body: <p>Suppose I have 4 resources which I want to utilize. 
  I create 4 subprocesses and then wait for 1 of them to be free and as soon as one of them is free I utilize the freed resource again.</p>
  
  <p>I want to know if there is any way we can find out which subprocess has finished working. As of now I am storing all the pid's of children in a list and using for loop to iterate.</p>
  
  <pre><code>for p in ps:
     p.wait()
  </code></pre>
  
  <p>But this blocks the application until the 1st process has finished. My objective is to wait until any of the subprocesses are finished.
  Please let me know any ideas.</p>