micro-manager / pymmdevice

(Experimental) Python device adapters for Micro-Manager
0 stars 0 forks source link

Multiple python Interpreters #9

Open henrypinkard opened 1 week ago

henrypinkard commented 1 week ago

from previous PR:

@henrypinkard If I understand correctly, one hub device corresponds to one python interpreter. Is it possible to multiple hubs/interpreters? For example, if there were an inefficiently written python device that is constantly holding the GIL, could making multiple python devices be a way around this?

@ IvoVellekoop Technically this is possible if the interpreters use the same runtime and virtual environment. However, is multiple hubs need different virtual environments (possibly with different Python versions) a problem occurs since only one Python runtime can be loaded once at the moment. Changing this would be very complex and error prone.

This sounds like it may not be worth it for now. I'm also hopeful that the GIL will be removed once and for all

marktsuchida commented 1 week ago

I agree that the PEP 684 multiple interpreters is not worth the limitations and complexity it would introduce. If we want that, we'd be much better off spinning up multiple Python processes, which I think is not out of the question if done right (i.e., without yet another from-scratch communication protocol).