Reduce ThreadManager default worker_thread to 2.
authorW. Trevor King <wking@drexel.edu>
Wed, 20 Oct 2010 09:25:50 +0000 (05:25 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 20 Oct 2010 09:25:50 +0000 (05:25 -0400)
pysawsim/manager/thread.py

index 95cae0ff36ba077093f7a8b4e97cee2d734d62ec..289b06c1a4bead0dc24567307c646f6b10b236fc 100644 (file)
@@ -74,8 +74,20 @@ class ThreadManager (JobManager):
      <Job 11>, <Job 12>, <Job 13>, <Job 14>, <Job 15>, <Job 16>, <Job 17>,
      <Job 18>, <Job 19>]
     >>> m.teardown()
+
+    Note that Python's Global Interpreter Lock (GIL) currently limits
+    threads to a single core.  See the following discussions:
+
+    * http://smoothspan.wordpress.com/2007/09/14/guido-is-right-to-leave-the-gil-in-python-not-for-multicore-but-for-utility-computing/
+    * http://docs.python.org/faq/library#id18
+    * http://www.artima.com/weblogs/viewpost.jsp?thread=214235
+    * http://www.snaplogic.com/blog/?p=94
+    * http://stackoverflow.com/questions/31340/
+
+    Increasing `worker_pool` will only help you get around IO blockin
+    at the cost increased time-slicing overhead.
     """
-    def __init__(self, worker_pool=5):
+    def __init__(self, worker_pool=2):
         super(ThreadManager, self).__init__()
         self._blocked = []
         self._spawn_queue = Queue()