Boston Linux & UNIX was originally founded in 1994 as part of The Boston Computer Society. We meet on the third Wednesday of each month, online, via Jitsi Meet.

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] Python programming questtion



On 7/4/26 11:04 AM, Jerry Feldman wrote:
> I have a python GTK app that uses paramiko to log into a remote host and
> perform a few tasks that populate a class. These work perfectly BUT...
> I do get a 'python not responding' dialog.
> Before I refactor the code,
> Would I be better off using the threading or multiprocess module.

Slightly off topic??

I once wrote a Python program that used Python multithreading and 
managed to easily peg all four cores on the computer. But everyone knows 
that isn't possible with Python because the global interpreter lock 
(GIL) keeps Python from doing more than one thing at a time and makes 
Python terrible at multi-threading.

I got away with it because the heaving lifting was all in opencv, 
running compiled C/C++ (I presume), and it mostly didn't need to lock 
the interpreter.

To the extent your Python threads are not executing Python but are in 
imports implemented in a real, compiled language, outside of Python's 
world, Python multithreading works great! To the extent your code is 
*in* Python, not so much.

This was a long time ago, I would hope that Python has gotten better 
since, but I am pretty sure the GIL is still out there making 
multithreading terrible..


I don't know how helpful that is, alas,

-kb





Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org