title: Python multiprocessing que is duplicated
body: <p>I'm creating sub-processes as <code>worker</code> objects that get and return data through <code>input</code> and <code>output</code> queues.
  However, when code is run, it seems that each subprocess obtains complete copy of the <code>input</code> queue and main thread does not get anything through <code>output</code> queue, which is causing deadlock. Why is that?</p>
  
  <pre><code>import threading, queue, multiprocessing
  class worker(multiprocessing.Process):
       def __init__(self,inp,out):
           super().__init__()
           self.input=inp
           self.output=out
           #real program has external subprocess initialization here
       def run(self):
           name=self.name
           while True:
               inp=self.input.get()
               if (inp is 'stop'):
                   break
               print('Process {} got task word: {}'.format(name,inp))
               print('queue size is: {}'.format(self.input.qsize()))
               self.output.put(inp.count('a'))
               print('Process {} input processed'.format(name))
           print('exiting {}'.format(name))
  
  if __name__ == "__main__":
      inp=queue.Queue()
      out=queue.Queue(maxsize=4)
      strings = ['asd', 'assa','aaa','as','aa','aaaq']
      for x in strings:
          inp.put(x)
      print(inp.qsize())
      workers=[worker(inp,out) for x in range(2)]
      for w in workers:
          w.start()
      res=[]
      for x in strings:
          res.append(out.get())
          print("intermediate result is {}".format(res))
      for _ in workers:
          inp.put('stop')
      for w in workers:
          w.join()
  
      print(res)
  </code></pre>
  
  <p>In the real problem each worker would initialize its own interface to another external program. I want to avoid repeating that initialization per each item, so I cannot simply convert worker to a function and use it with <code>map</code>. </p>
  
  <p>If <code>multiprocessing.Process</code> is replaced with <code>threading.Thread</code> which has the same api, the program works correctly, but on single core which is unacceptable for the task.</p>