title: Parallelism in python isn't working right
body: <p>I was developing an app on gae using python 2.7, an ajax call requests some data from an API, a single request could take ~200 ms, however when I open two browsers and make two requests at a very close time they take more than the double of that, I've tried putting everything in threads but it didn't work.. (this happens when the app is online, not just on the dev-server)</p>
  
  <p>So I wrote this simple test to see if this is a problem in python in general (in case of a busy wait), here is the code and the result: </p>
  
  <pre><code>def work():
      t = datetime.now()
      print threading.currentThread(), t
      i = 0
      while i &lt; 100000000:
          i+=1
      t2 = datetime.now()
      print threading.currentThread(), t2, t2-t
  
  if __name__ == '__main__': 
      print "single threaded:"
      t1 = threading.Thread(target=work)
      t1.start()
      t1.join()
  
      print "multi threaded:"
      t1 = threading.Thread(target=work)
      t1.start()
      t2 = threading.Thread(target=work)
      t2.start()
      t1.join()
      t2.join()
  </code></pre>
  
  <p>The result on mac os x, core i7 (4 cores, 8 threads), python2.7:</p>
  
  <pre><code>single threaded:
  &lt;Thread(Thread-1, started 4315942912)&gt; 2011-12-06 15:38:07.763146
  &lt;Thread(Thread-1, started 4315942912)&gt; 2011-12-06 15:38:13.091614 0:00:05.328468
  
  multi threaded:
  &lt;Thread(Thread-2, started 4315942912)&gt; 2011-12-06 15:38:13.091952
  &lt;Thread(Thread-3, started 4323282944)&gt; 2011-12-06 15:38:13.102250
  &lt;Thread(Thread-3, started 4323282944)&gt; 2011-12-06 15:38:29.221050 0:00:16.118800
  &lt;Thread(Thread-2, started 4315942912)&gt; 2011-12-06 15:38:29.237512 0:00:16.145560
  </code></pre>
  
  <p>This is pretty shocking!! if a single thread would take 5 seconds to do this.. I thought starting two threads at the same time will take the same time to finish both tasks, but it takes almost triple the time.. this makes the whole threading idea useless, as it would be faster to do them sequentially! </p>
  
  <p>what am I missing here..</p>