简体   繁体   English

为什么我的沉重Python脚本在Windows上暂停了? 可以预防吗?

[英]Why is my heavy python script pausing on windows? Can it be prevented?

There is a python script I built called convert.py , which is a file converter (SQLite3 -> SQLite3). 我构建了一个名为convert.py的python脚本,它是一个文件转换器(SQLite3-> SQLite3)。 It takes about 30 minutes to finish, working on with heavy CPU and I/O. 使用繁重的CPU和I / O大约需要30分钟才能完成。

I opened 30 CMD.EXE windows on my computer (Windows 7, CPU with 2 cores and hyper-threading), and started convert.py on each window. 我在计算机上打开了30个CMD.EXE窗口(Windows 7,具有2个核心和超线程的CPU),并在每个窗口上启动了convert.py I let them work over night, so I expected that it will be all done until next morning ... but it didn't. 我让他们通宵工作,所以我希望这一切要到第二天早上才能完成……但是没有。 Only half of them were done. 其中只有一半完成了。 The CPU monitor log told me that my computer was working 100% on it for 1 hour and suddenly it started to use only 25%. CPU监视器日志告诉我,我的计算机在100%的条件下工作了1个小时,然后突然开始仅使用25%。 It seems that all CPU power wasn't used for the left tasks. 似乎所有的CPU功能都没有用于剩下的任务。

The left tasks resumed it work when I pressed Ctrl+C on it. 当我按Ctrl + C时,剩下的任务使它恢复工作。

So, what is going on? 那么发生了什么? Is this problem a python's problem, or windows' problem? 这个问题是python的问题,还是Windows的问题? Is there a way to let my computer work constantly 100% on my python script until all of them are done? 有没有一种方法可以让我的计算机在我的python脚本上100%持续工作,直到完成所有操作?

The reason was that each process used massive memory, and I tried to work it concurrently. 原因是每个进程都使用大量内存,因此我尝试同时工作。 It was over capacity. 超出容量。 It was frequently swapping out , but it was hidden by SQLite access which was also working hard with my HDD. 它经常交换出去 ,但是被SQLite访问隐藏了,SQLite访问也在与我的HDD一起工作。

I would like to thank Lennart, who notified me to check other params in my computer, and everybody who gave me guesses and hints, since I gave too less information about the issues occuring in front of me. 我要感谢Lennart,他通知我检查计算机中的其他参数,也感谢所有给我猜测和提示的人,因为我对我面前发生的问题的了解太少了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM