title: Python 2.7 concurrent.futures.ThreadPoolExecutor does not parallelize
body: <p>I am running the following code on a Intel i3-based machine with 4 virtual cores (2 hyperthreads/physical core, 64bit) and Ubuntu 14.04 installed:</p>
  
  <pre><code>n = multiprocessing.cpu_count()
  executor = ThreadPoolExecutor(n)
  tuple_mapper = lambda i: (i, func(i))
  results = dict(executor.map(tuple_mapper, range(10)))
  </code></pre>
  
  <p>The code does not seem to be executed in a parallel fashion, since the CPU is utilized only 25% constantly. On the utilization graph only one of the 4 virtual cores is used 100% at a time. The utilized cores are alternating every 10 seconds or so. </p>
  
  <p>But the parallelization works well on a server machine with the same software setting. I don't know the exact number of cores nor the exact processor type, but I know for sure that it has several cores and the utilization is at 100% and that the calculations have a rapid speedup (10 times faster after using parallelization, made some experiments with it).</p>
  
  <p>I would expect, that parallelization would work on my machine too, not only on the server.</p>
  
  <p>Why does it not work? Does it have something to do with my operating system settings? Do I have to change them?</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>Update:</strong>
  For the background information see the correct answer below. For the sake of completeness, I want to give a sample code which solved the problem:</p>
  
  <pre><code>tuple_mapper = lambda i: (i, func(i))
  n = multiprocessing.cpu_count()
  with concurrent.futures.ProcessPoolExecutor(n) as executor:
      results = dict(executor.map(tuple_mapper, range(10)))
  </code></pre>
  
  <p>Before you reuse this take care that all functions you are using are defined at the top-level of a module as described here:
  <a href="https://stackoverflow.com/questions/8804830/python-multiprocessing-pickling-error">Python multiprocessing pickling error</a></p>