title: Python, multithreading too slow, multiprocess
body: <p>I'm a multiprocessing newbie,</p>
  
  <p>I know something about threading but I need to increase the speed of this calculation, hopefully with multiprocessing:</p>
  
  <blockquote>
    <p><strong>Example Description:</strong> sends string to a thread, alters string + benchmark test,
    send result back for printing.</p>
  
  <pre><code>from threading import Thread
  
  class Alter(Thread):
      def __init__(self, word):
          Thread.__init__(self)
          self.word = word
          self.word2 = ''
  
      def run(self):
          # Alter string + test processing speed
          for i in range(80000):
              self.word2 = self.word2 + self.word
  
  # Send a string to be altered
  thread1 = Alter('foo')
  thread2 = Alter('bar')
  thread1.start()
  thread2.start()
  
  #wait for both to finish
  while thread1.is_alive() == True: pass
  while thread2.is_alive() == True: pass
  
  
  print(thread1.word2)
  print(thread2.word2)
  </code></pre>
  </blockquote>
  
  <p>This is currently takes about 6 seconds and I need it to go faster.<br>
  I have been looking into multiprocessing and cannot find something equivalent to the above code. I think what I am after is <strong>pooling</strong> but examples I have found have been hard to understand. I would like to take advantage of all cores (8 cores) <code>multiprocessing.cpu_count()</code> but I really just have scraps of useful information on multiprocessing and not enough to duplicate the above code. If anyone can point me in the right direction or better yet, provide an example that would be greatly appreciated. Python 3 please</p>