title: Python Multiprocessing combined with Multithreading
body: <p>I am not sure if what i am trying to do is a valid practice but here it goes:
  I need my program to be highly parallelized so i thought i could make 2-3 processes and each process can have 2-3 threads.</p>
  
  <p>1) Is this possible?
  2) Is there any point into it?
  3) This is my code but it hangs when i try to join the processes.</p>
  
  <pre><code>PQ = multiprocessing.Queue()
  </code></pre>
  
  <p>[...]</p>
  
  <pre><code>def node(self, files, PQ):
  
          l1, l2 = self.splitList(files)
          p1 = multiprocessing.Process(target=self.filePro, args=(l1,PQ,))
          p2 = multiprocessing.Process(target=self.filePro, args=(l2,PQ,))
          p1.daemon = True
          p2.daemon = True
          p1.start()
          p2.start()
  
          p1.join() # HANGS HERE
          p2.join()
          while 1:
              if PQ.empty():
                  break
              else:
                  print(PQ.get())
          PQ.join()
  
      def filePro(self,lst,PQ):
          TQ = queue.Queue()
          l1, l2 = self.splitList(lst)
          t1 = threading.Thread(target=self.fileThr, args=('a',l1,TQ,))
          t2 = threading.Thread(target=self.fileThr, args=('b',l2,TQ,))
          t1.daemon = True
          t2.daemon = True
          t1.start()
          t2.start()
  
          t1.join()
          t2.join()
          while 1:
              if TQ.empty():
                  break
              else:
                  PQ.put(TQ.get())
                  TQ.task_done()
          TQ.join()
  
  def fileThr(self,id,lst,TQ):
          while lst:
              tmp_path = lst.pop()
              if (not tmp_path[1]):
                  continue
              for item in tmp_path[1]:
                  TQ.put(1)
          TQ.join()
  </code></pre>