Why does my Python program average only 33% CPU per process? How can I make Python use all available CPU?

后端 未结 7 1856
难免孤独
难免孤独 2021-02-01 08:11

I use Python 2.5.4. My computer: CPU AMD Phenom X3 720BE, Mainboard 780G, 4GB RAM, Windows 7 32 bit.

I use Python threading but can not make every python.exe process co

7条回答
  •  时光说笑
    2021-02-01 08:45

    Global Interpreter Lock

    The reasons of employing such a lock include:

    * increased speed of single-threaded programs (no necessity to acquire or release locks
      on all data structures separately)
    * easy integration of C libraries that usually are not thread-safe.
    

    Applications written in languages with a GIL have to use separate processes (i.e. interpreters) to achieve full concurrency, as each interpreter has its own GIL.

提交回复
热议问题