Python and multi-threading. Is it a good idea?



No its not a good idea,actually.

Python doesn't allow multi-threading ,but if you want to run your program speed that needs to wait for something like IO then it use a lot. Where as the threading package couldnt let you to use extra CPU cores python doesn't support multi-threading because python on the Cpython interpreter does not support true multi-core execution via multithreading. However, Python DOEShave a Threading library. The GIL does not prevent threading. All the GIL does is make sure only one thread is executing Python code at a time; control still switches between threads. If you mix in C extensions and I/O, however (such as PIL or numpy operations) and any C code can run in parallel with one active Python thread.

raja
Sri
Published on 23-May-2019 12:16:40
Advertisements