Question about python GIL

Is there a presence of python GIL in that with python multithreading, the same operation is not so much different from repeating in a single thread ?.

For example, if I need to upload two files, what is the advantage of executing them in two threads instead of loading them one by one ?.

I tried a big math operation in both directions. But they seem to be almost equal to the time to complete.

It seems incomprehensible to me. Can someone help me with this? Thanks.

+3
source share
3 answers

Python , . (, 2,5) , :

  • -Python- (, C, ​​ ..), Python . Python, . , -, - , Python.

  • GIL Python, CPython ( , Python, , "python" Linux - .

    Jython, IronPython Python GIL, pure-Python .

  • 0,5: -Python , . , .

+11

, . GIL Python . , , , GIL, HTTP- ( , HTTP , ).

, , , . , ( , , , ).

+4

It depends on the executable executable. Native modules can free the GIL, and then leave and do their thing, allowing another thread to block the GIL. Normally, the GIL is stored when the code, both python and native, runs on python objects. If you want more information, you probably need to read a little and read about it. :)

See: What is a global interpreter lock (GIL)? and Topic Status and Global Interceptor Lock

+3
source

Source: https://habr.com/ru/post/1725804/


All Articles