to py or not to py ?
Carl J. Van Arsdall
cvanarsdall at mvista.com
Wed Jun 28 13:21:12 EDT 2006
Robert Kern wrote:
>> Carl , what are the problems that could arise with threading ??
>>
Because of the GIL only one thread can actually run at a time. So if
you are going for speed (say you have an SMP box) and your two requests
require significant computation, you'd want each processor to take on a
little bit of that work to get things done faster. Now say you want
these two to be computed simultaneously and you are using python, you
won't get that, one thread will process and then the other will process
as the GIL is passed around between the python threads. Now if your
bottleneck is IO then you are in good shape for python threads (Your
machine only has one network port and you don't have a lot of
computation overhead, so your single processor can serve things up
faster than your network card can take it).
So its not problems that arise, its more like inefficiency. Anyhow, it
all depends on what you are trying to do and the needs of your
application.
-carl
--
Carl J. Van Arsdall
cvanarsdall at mvista.com
Build and Release
MontaVista Software
More information about the Python-list
mailing list