+ 3
Python and multi-threading. Is it a good idea? What are some ways to get some Python code to run in a parallel way.
2 Respostas
+ 4
An example using multprocessing:
https://code.sololearn.com/cPyfXZGRo5sr/?ref=app
On SoloLearn there isn't enough memory for our codes to import the full module, so the ".dummy" import allows me to write code for the module (which then runs serially).
Note that the Global Interpreter Lock (GIL) matters with simultaneously executing code; I've added another answer to this effect.
+ 4
Grok the GIL: How to write fast and thread-safe Python We explore Python's global interpreter lock and learn how it affects multithreaded programs.
https://opensource.com/article/17/4/grok-gil