我如何编程限制我的程序的CPU使用率低于70%? [英] How can I programmatically limit my program's CPU usage to below 70%?

查看:151
本文介绍了我如何编程限制我的程序的CPU使用率低于70%?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我成为构建我的程序的时候,我已经观察到,大部分的程序需要2〜3分钟来执行,当我检查任务调度,我看到他们消耗100%的CPU更注重健康用法,我可以在code编程限制这种用法?这必将使我能够在给定时间运行多个程序。

Of late, I'm becoming more health oriented when constructing my program, I have observed that most of programs take 2 or 3 minutes to execute and when I check on the task scheduler, I see that they consume 100% of CPU usage, can I limit this usage programatically in code? This will certainly enable me to run multiple programs at a given time.

谢谢,
尼迪

推荐答案

这不是你的关心...这是操作系统的工作,正在运行的进程之间分配处理器时间。如果你想给其他进程在得到他们的东西做的第一条裂缝,然后只需通过修改降低自己进程的优先级的<一个href=\"http://msdn.microsoft.com/en-us/library/system.diagnostics.process.priorityclass.aspx\"><$c$c>Process.PriorityClass它的价值。

That's not your concern... It's the job of the operating system to distribute processor time between running processes. If you'd like to give other processes first crack at getting their stuff done, then simply reduce the priority of your own process by modifying the Process.PriorityClass value for it.

这篇关于我如何编程限制我的程序的CPU使用率低于70%?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆