From: W. Trevor King Date: Wed, 20 Oct 2010 09:25:50 +0000 (-0400) Subject: Reduce ThreadManager default worker_thread to 2. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1d9b1aa5357238728dbc04a53fd62ac19b698e06;p=sawsim.git Reduce ThreadManager default worker_thread to 2. --- diff --git a/pysawsim/manager/thread.py b/pysawsim/manager/thread.py index 95cae0f..289b06c 100644 --- a/pysawsim/manager/thread.py +++ b/pysawsim/manager/thread.py @@ -74,8 +74,20 @@ class ThreadManager (JobManager): , , , , , , , , ] >>> 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()