How do threads work in Python, and what are common Python-threading specific pitfalls?

前端 未结 7 1418
一个人的身影
一个人的身影 2020-11-27 11:13

I\'ve been trying to wrap my head around how threads work in Python, and it\'s hard to find good information on how they operate. I may just be missing a link or something,

7条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 11:37

    Try to remember that the GIL is set to poll around every so often in order to do show the appearance of multiple tasks. This setting can be fine tuned, but I offer the suggestion that there should be work that the threads are doing or lots of context switches are going to cause problems.

    I would go so far as to suggest multiple parents on processors and try to keep like jobs on the same core(s).

提交回复
热议问题