title: Sharing dictionary in multiprocessing with python
body: <p>In my program I need to share a dictionary between processes in multiprocessing with Python. I've simplified the code to put here an example:</p>
  
  <pre><code>import multiprocessing
  def folding (return_dict, seq):
      dis = 1
      d = 0
      ddg = 1 
      '''This is irrelevant, actually my program sends seq parameter to other extern program that returns dis, d and ddg parameters'''
      return_dict [seq] = [dis, d, ddg]
  
  seqs = ['atcgtg', 'agcgatcg', 'atcgatcgatc', atcggatcg', agctgctagct']
  manager = Manager()
  return_dict = manager.dict()
  n_cores = 3
  
  for i in range (0, len(seqs), n_cores) #n_cores is the number of cores availables in the computer, defined by the user
      subseqs = seqs[i:i + n_cores]
      processes = [Process(target=folding, args =(return_dict, seq)) for seq in subseqs]
      for p in processes:
          p.start()
      for p in processes:
          p.join()
  
  for i in retun_dict:
      print i
  </code></pre>
  
  <p>I expected to have at the end of the program the return_dict with all of the property values. 
  When I run my program, that has to do this with seqs list of thousand of sequences and repeat it lot of times, sometimes I get the correct result, but sometimes (the most part of the times) the program never ends, but retuns any error, and I have no idea what is going wrong.
  Futhermore, I think that this is not very efficient in time, I wanted to know if there are other way to do this most efficiently and faster.
  Thank you every body! </p>