2 ms·
If you have long running, computationally intensive code, with simple interactions, sure. Then multiple processes is the right thing. But sometimes you are wri
by captainmuon 9y ago
If you have long running, computationally intensive code, with simple interactions, sure. Then multiple processes is the right thing.
But sometimes you are writing a GUI app, or some "real time" code [1]. You put blocking calls onto a different thread to keep the UI responsive. But then you find that still the blocking calls freeze the UI across threads due to the GIL.
Pure Python code is not the problem in this case - the GIL gets released between statements often enough. It is long running C code. You could release the GIL manually in there, but it is not done everywhere. Also, there are often calls that are supposed to be instant (like opening a file, or starting an async operation), that take seconds under bad conditions (when the network is down).
----
[1] well, with Python probably not in the strict definition of real time, but say you are controlling some external device