GIL on SMP (need quick answer for the boss :) - thanks!

"Martin v. Löwis" martin at v.loewis.de
Sat Feb 14 12:03:46 EST 2004


max khesin wrote:
> I have 3 questions:
> 
> 1) (this is the killer) - is GIL going to get me into trouble?

Define "trouble". You will not get in conflict with law enforcement
because of that Python code :-)

If you are asking "does it do what you think it does?", then "yes,
it does precisely what I think it does."

If you are asking "does it do what I think it does?", then "I
don't know, because I don't know what you are thinking".

> 2) any problems having multiple threads write to the log (the standard 
> Python logger). 

It should work fine.

> In general, is there an easy way to determine if a 
> particular Python lib is thread-safe, at least for the standard libs?

No. It starts with the lack of a clear definition of "thread-safe".
In most cases, if a library has what many people would consider a
serious problem, this problem has been either documented or fixed
by now.

OTOH, many libraries implemented in pure Python will act strangely
if two threads try to manipulate the same data structures. In many
cases, this is not considered a serious problem because one would
normally not attempt to use that data structure from two threads.

Regards,
Martin




More information about the Python-list mailing list