decorators vs GIL

Jimmy Retzlaff jimmy at retzlaff.com
Mon Aug 9 21:55:17 EDT 2004


Jarek Zgoda wrote:
> Try GUI programming without using threads.

Windows and MacOS didn't offer support for multi-processing that was
anywhere near as SMP friendly as Python's current GIL laden threads for
several major versions of each. I believe it took Microsoft something
like 6-8 years to add threads to Windows (and at that point it was only
in NT which was far from mainstream) and Apple took something like 10
years and then only the main thread could make OS calls (e.g., no file,
network, or GUI access was possible in background threads). So, a few of
us have successfully done GUI programming without using threads - in
fact very little commercial GUI software used threads before 1995.

I've done GUI programming for more than 15 years (5 of those in Python)
and the only time the GIL (or the lack of threads in Win/Mac) has come
close to getting in my way has been in non-GUI apps that needed to do
lots of number crunching. The GIL turned out to be a blessing in
disguise for me. It led me to split my processing into multiple
processes (which took a matter of minutes). That enabled me to run my
app on several machines instead of just 2 CPUs which gave me MUCH more
capacity.

I'm sure there are apps where the GIL would truly be a problem, but I
share the opinion that those are a tiny fraction of the total number of
Python programs. I suspect Python's computational performance would be
at least as big a problem in many of those cases. I would definitely be
interested in reading about specific cases as opposed to general fears,
but they aren't posted very often.

Jimmy




More information about the Python-list mailing list