title: Python multiprocessing not working concurrently, but separately
body: <p>I'm having a little bit of a confusion with the <code>multiprocessing</code> module in python. So far in my code, I want to create a separate process for the generate_pings() function, so then that process runs independent of the main process in the main function.</p>
  
  <p>But when I print this out, all of the generate_pings() output comes first, then the count to 999. How do I get them to run at the same time? I've tried using the threading module but it confused me a little bit. </p>
  
  <p>Also when exactly do I use the .join()?</p>
  
  <p>Thanks</p>
  
  <pre><code>import multiprocessing
  #generate pings so packets are moving, have this running in a separate thread
  def generate_pings():
      count = 0
      while count &lt; 1:
  
  
          ping_respose = subprocess.call(["ping -c 50 -i 0.1 weissmanscore.com"], shell=True)    
  
          count+=1
      return
  
  
  def main():
      print "welcome"
      try:
          p = multiprocessing.Process(target=generate_pings)
          p.start()
      except:
          print "Error: unable to start thread"
      p.join()
      i = 0
      while i &lt; 1000:
          print i
          i+=1
  
  
  
  
  if __name__ == '__main__':
      main()
  </code></pre>