1.

How Multithreading will be achieved in Python?

Answer»
  • Python has a Global Interpreter Lock (GIL) that makes sure only one of your ‘threads’ can be executed at a time. A thread will acquire the GIL, does a small amount of work, then the GIL will be passed onto the next thread.
  • This happens so QUICKLY as if your threads are executing in parallel, but in reality, they are just taking turns using the same CPU core.
  • All this GIL PASSING process will add overhead to the execution. This indicates that, if you want to speed up your code run, then the usage of the threading package often is not considered to be a GOOD idea.


Discussion

No Comment Found