Python: GIL Global Lock thread

Limit global independent threads running thread lock (Global Interpreter Lock), namely Python in order to ensure thread safety taken, it means a nucleus can only run one thread at the same time. For the io-intensive tasks, python multithreading play role, but for cpu-intensive tasks, python multithreading almost account for less than any advantage, because there may be competition for resources and slow down.
The solution is multi-process and following coroutine (coroutine only a single CPU, but can reduce the cost of switching to improve performance).

Guess you like

Origin blog.csdn.net/weixin_44523387/article/details/91789854