Setting the base priority of my application

cBarry263

Active member
Joined
Oct 29, 2005
Messages
42
Location
Maryland
Programming Experience
Beginner
I am writing an application that I only want to run if the CPU is not busy working on a higher priority process. Is there any way I can set my app up as a "low base priority"??
 
VB.NET:
Process.GetCurrentProcess.PriorityClass = ProcessPriorityClass.BelowNormal
note: BelowNormal causes exception on Win98.
 
thanks for the quick reply. A little curious on how this works....I have this statement at the beginning of my program, it's the 3rd line of Sub Main() ( right after setting up a logfile). So once this line executes, it will terminate the rest of the app if a higher priority process requests CPU cycles?
 
No, not at all, this will just set the priority for cpu time of your application lower than any normal application. It will not terminate, it's thread will just enter a wait state and any processing instructions from this have to wait until higher priority processes is finished. There will usually still be much cpu time it will utilize to operate in between normal processing.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdiagnosticsprocesspriorityclassclasstopic.asp
 
Back
Top