title: Processing a long list using Multiprocessing
body: <pre><code>output = mp.Queue()
  
  def endScoreList(all_docs, query, pc, output):
      score_list = []
      for doc in all_docs:
          print "In process", pc
          score_list.append(some_score(doc, query))
          print "size of score_list is", len(score_list)
      output.put((doc, score_list))
  
  if __name__ == '__main__':
      mp.freeze_support()
      num_of_workers = mp.cpu_count()
      doc_list = getDocuments(query)
      ## query is a list of strings.
      ## doc_list is a list of document names
      processes = [mp.Process(target = endScoreList, args = (doc_list, x, query, output)) for x in range(num_of_workers)]
      for p in processes:
          p.start()
      for p in processes:
          p.join()
      results = [output.get() for p in processes]
      print results
  </code></pre>
  
  <p>I have a list of document names <code>all_docs</code> whose data I have to compare with an input <code>query</code>. This is done using score that I get from <code>some_score(doc, query)</code>. The list of documents is ~100k. I have to get scores of all the documents. How can I make a program so that the scores are generated  parallelly. The scores are independent of each other so in the end I just have to merge all the returned list of <code>(doc, score)</code>. I tried to make a program, but I don't think it is running parallelly.</p>
  
  <p>Please help me out.</p>
  
  <p>I am using Windows 64-Bit/i7.</p>