写一个低优先级的程序 [英] Writing a low-priority program

查看:49
本文介绍了写一个低优先级的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个以最低执行率运行的程序

优先级。也就是说,我希望程序基本上运行在

背景中,对计算机系统的性能影响很小,因为这可能是
。该程序将执行一些后台备份任务。


我有理由相信第一步是创建一个线程,并分配

线程可能的最低执行优先级。我应该注意哪些其他

技巧,建议,技巧等?有没有人知道的好的例子或教程?


TIA,


Richard Rosenheim
>
" Richard L Rosenheim" < RI ***** @ rlr.com>在留言中写道

新闻:e2 ************* @ TK2MSFTNGP10.phx.gbl ...

我正在寻找编写一个以最低执行率优先运行的程序。也就是说,我希望程序基本上在
背景中运行,对计算机系统的性能影响很小。该程序将执行一些后台备份任务。

我有理由相信第一步是创建一个线程,并为线程分配最低的执行优先级可能。我应该注意其他任何技巧,建议,技巧等吗?有没有人知道的好例子或教程?

TIA,

Richard Rosenheim



感谢您的回复。另一个问题 - 是否有可能(或者甚至建议将b / b
)设置为实际程序的优先级为空闲,或者必须/应该

我生成一个单独的线程我将该线程的优先权设置为闲置?


Richard Rosenheim

Willy Denoyette [MVP]" <无线************* @ pandora.be>在消息中写道

新闻:O8 ************** @ TK2MSFTNGP11.phx.gbl ...

只需运行您的流程The ProcessPriorityClass.Idle。

Willy。

Richard L Rosenheim < RI ***** @ rlr.com>在消息中写道
新闻:e2 ************* @ TK2MSFTNGP10.phx.gbl ...

我正在写一个程序,以最低的执行率优先运作。也就是说,我希望程序基本上在
背景中运行,对计算机系统的性能影响很小。该程序将执行一些后台备份任务。

我有理由相信第一步是创建一个线程,并为线程分配最低的执行优先级可能。我应该注意其他任何技巧,建议,技巧等吗?是否有
任何人都知道的好例子或教程?

TIA,

Richard Rosenheim




Richard,

不,只需抓住CurrentProcess并将其设置为空闲等级。


....

处理currentProcess = Process.GetCurrentProcess();

currentProcess.PriorityClass = ProcessPriorityClass.Idle;

....


Willy。


" Richard L Rosenheim" < RI ***** @ rlr.com>在消息中写道

新闻:OI ************** @ TK2MSFTNGP12.phx.gbl ...

感谢您的回复。另一个问题 - 是否有可能(或者甚至是可取的)将实际程序的优先级设置为空闲,或者
必须/应该
我产生一个单独的线程,我在其中设置线程优先闲置?

Richard Rosenheim

Willy Denoyette [MVP]" <无线************* @ pandora.be>在消息中写道
新闻:O8 ************** @ TK2MSFTNGP11.phx.gbl ...

只需使用ProcessPriorityClass.Idle运行您的流程威利。

Richard L Rosenheim < RI ***** @ rlr.com>在消息中写道
新闻:e2 ************* @ TK2MSFTNGP10.phx.gbl ...

>我正在寻找一个以最低执行率运行的程序
>优先考虑。也就是说,我希望程序基本上运行在
>背景对计算机的性能影响不大
>系统
> as
>可能。该程序将执行一些后台备份任务。
>
>我有理由相信第一步是创建一个线程,并且
>分配
>线程可能的最低执行优先级。还有其他
>我应该注意哪些技巧,建议,技巧等?有什么>任何人都知道的好例子或教程?
>
> TIA,
>
> Richard Rosenheim
>
>





I''m looking to write a program that operates at the lowest execution
priority possible. That is, I want the program to basically run in the
background having as little impact on the performance of computer system as
possible. The program will do some background backup tasks.

I''m reasonably sure that the first step is to create a thread, and to assign
the thread the lowest execution priority possible. Are there any other
techniques, advice, tricks, etc. that I should be aware of? Are there any
good examples or tutorials that anyone knows of?

TIA,

Richard Rosenheim

解决方案

Just run your process with the ProcessPriorityClass.Idle.

Willy.

"Richard L Rosenheim" <ri*****@rlr.com> wrote in message
news:e2*************@TK2MSFTNGP10.phx.gbl...

I''m looking to write a program that operates at the lowest execution
priority possible. That is, I want the program to basically run in the
background having as little impact on the performance of computer system
as
possible. The program will do some background backup tasks.

I''m reasonably sure that the first step is to create a thread, and to
assign
the thread the lowest execution priority possible. Are there any other
techniques, advice, tricks, etc. that I should be aware of? Are there any
good examples or tutorials that anyone knows of?

TIA,

Richard Rosenheim



Thanks for the reply. One other question -- is it possible (or even
advisable) to set the priority of the actual program to idle, or must/should
I spawn a separate thread in which I set that thread''s priority to idle?

Richard Rosenheim
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:O8**************@TK2MSFTNGP11.phx.gbl...

Just run your process with the ProcessPriorityClass.Idle.

Willy.

"Richard L Rosenheim" <ri*****@rlr.com> wrote in message
news:e2*************@TK2MSFTNGP10.phx.gbl...

I''m looking to write a program that operates at the lowest execution
priority possible. That is, I want the program to basically run in the
background having as little impact on the performance of computer system
as
possible. The program will do some background backup tasks.

I''m reasonably sure that the first step is to create a thread, and to
assign
the thread the lowest execution priority possible. Are there any other
techniques, advice, tricks, etc. that I should be aware of? Are there any good examples or tutorials that anyone knows of?

TIA,

Richard Rosenheim




Richard,
No, just grap the CurrentProcess and set it''s prioryty class to Idle.

....
Process currentProcess = Process.GetCurrentProcess();
currentProcess.PriorityClass = ProcessPriorityClass.Idle;
....

Willy.

"Richard L Rosenheim" <ri*****@rlr.com> wrote in message
news:OI**************@TK2MSFTNGP12.phx.gbl...

Thanks for the reply. One other question -- is it possible (or even
advisable) to set the priority of the actual program to idle, or
must/should
I spawn a separate thread in which I set that thread''s priority to idle?

Richard Rosenheim
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:O8**************@TK2MSFTNGP11.phx.gbl...

Just run your process with the ProcessPriorityClass.Idle.

Willy.

"Richard L Rosenheim" <ri*****@rlr.com> wrote in message
news:e2*************@TK2MSFTNGP10.phx.gbl...

> I''m looking to write a program that operates at the lowest execution
> priority possible. That is, I want the program to basically run in the
> background having as little impact on the performance of computer
> system
> as
> possible. The program will do some background backup tasks.
>
> I''m reasonably sure that the first step is to create a thread, and to
> assign
> the thread the lowest execution priority possible. Are there any other
> techniques, advice, tricks, etc. that I should be aware of? Are there any > good examples or tutorials that anyone knows of?
>
> TIA,
>
> Richard Rosenheim
>
>





这篇关于写一个低优先级的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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