Writing a low-priority program

  • Thread starter Thread starter Richard L Rosenheim
  • Start date Start date
R

Richard L 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
 
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
 
Richard,
No, just grap the CurrentProcess and set it's prioryty class to Idle.

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

Willy.
 
Thanks again.

Richard Rosenheim


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

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

Willy.
 
Priority setting for your current program mainthread

Threading.Thread.CurrentThread.Priority = Threading.ThreadPriority.Lowest

I hope this helps?

Cor
 
Back
Top