Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a way to configure a Windows service process (e.g. squidNT, SQL Server, etc) to start automatically with low priority without manually changing process priority via Task Manager?

share|improve this question
    
Changing the priority of threads or processes is usually a bad idea, unless the code has been written to run at a different priority. Changing priorities adds "priority inversion" to the list of concurrency issues to avoid. –  Richard Sep 21 '09 at 9:12
add comment

2 Answers

The Service Control Manager, which handles starting / stopping services, doesn't have any mechanism (in any version of Windows heretofore) to specify the priority on processes it starts.

Since you can modify the priority on an already-running process, your best bet might be to use a tool to do that.

I'm not aware of a Microsoft command-line tool to modify process priority, but the "PV" command-line too, available at http://www.teamcti.com/pview/prcview.htm has a function to set priority.

pv -pb process-name.exe

That would set "process-name.exe" to "Below Normal" priority.

If you can live with the process starting out at "Normal" priority until you get around to changing it, you could do so with a script running as a "Scheduled Task" to fire off every-so-often (in case the service gets bounced).

It's a quick and dirty hack, but I owe a lot of my fortune in life to quick and dirty hacks that get the job done!

share|improve this answer
    
Maybe run a batch file to start the app and then set the process priority, with perhaps a short sleep in between, rather than running the app directly and then running another task to set the priority. Won't work for everything but worth a try. –  John Gardeniers Sep 21 '09 at 2:38
add comment

The following might also work. Edit the ImagePath registry key, and use the start command from cmd.exe:

START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED] [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL] [/WAIT] [/B] [command/program] [parameters]

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.