Issue
I'm running Python programs (both on IPython/Jupyter Lab and on the command line) that aren't running any threading or standard multiprocessing libraries. Because of the GIL, am I to assume that these python program will only use and run on 1 CPU core? I'm deducing this from when searching this result but nowhere am I getting a definite answer. Are there any example libraries outside of multiprocessing that can get Python programs to use more than 1 CPU core?
Is this the same for other programs in, say, Java or C++?
Asking three questions here but I figure they're related towards understanding how (Python) programs use CPU. If I lack understanding in some place please let me know.
Assume the programs being run are not dependent on concurrency, but could be run faster if developed to do so.
Solution
Python, Java and C++ programs, unless specifically coded to use multithreading or multiprocessing, will only utilize a single core. That is not to say that when such a program goes into a wait state, for example waiting for I/O to complete, and then resumes execution that it will be assigned the same core it had just been using.
However, some Python libraries you are importing could possibly be using multiprocessing without your realizing it. Such programs would be using multiple cores.
Answered By - Booboo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.