Concurrency with Python: Threads and Locks
bytes.yingw787.com
bytes.yingw787.com
Too bad, because you want to isolate things sometime.
In practice, no
Can I ask you one example of what you mean? I want 2 separate event loop for 2 separate threads
Yes, you can use multiple processes to mitigate some of the problems, but you will create other problems (for example: you now have to serialize all the objects through a message pipeline, which is expensive, or you have to use shared memory, which also requires copy operations, unless you want to write your entire code in a low-level kind of way but in that case, you might as well use a different language like C). In an existing system, moving everything to a different process can be a cumbersome experience.
What you really want is multicore support with a garbage collector that is concurrent and a runtime that doesn't have a global lock. Sadly, few environments support this. Erlang comes to mind, but also doesn't support structural sharing. Ocaml is working on multicore support [1]. GoLang, Haskell and Java seem your best choice for GC+multicore.
Why? With cpython there are plenty of cases where parallelism is possible with threads because the GIL is released (for instance most IO operations and many C based number crunching operations), making threads and locks useful.
Can't you see a problem here?
The io-related problems I had with paramiko, on the other hand - last time I checked could neither be solved with threads or gevent.
So that’s a weak point to be made anyway.
I believe .NET also fits the bill.