Solved

Start the service with low priority.

Posted on 2004-04-06
17
4,924 Views
Last Modified: 2013-12-28
Does anyone came across a tip on how to start a service at a different priority than other services running on the same server?
I know that the START command can do it, however I have real services (not custom-developed cmd.exe batch processes) and I cannot use this command within the Registry entry of the service.

Thank you.
0
Comment
Question by:sstouk
  • 6
  • 5
  • 3
  • +3
17 Comments
 
LVL 7

Expert Comment

by:shahrial
Comment Utility
try this.
1.) Run the service, go to Task Manager, find the service,
right click on the service - select Set Priority -> change it to low. ;)

0
 
LVL 6

Author Comment

by:sstouk
Comment Utility
I need it to Start with the low priority, not to change it when it already started.
And by the way, it is "access denied" when attempting to change the priority from the Task Manager.
0
 
LVL 30

Expert Comment

by:Gareth Gudger
Comment Utility
I dont even have an NT box to check anymore but have you checked in the Control Panel ==> Services

0
 
LVL 16

Expert Comment

by:ahmedbahgat
Comment Utility
Set priority is used for currently running processes which will affect only the cpu gain regarding that process, it is not recommended to change the priority of running processes as recomended by MS, you wonder why they put there from the first place, possibly for troubleshooting, as far as i know there is no such thing for services

the cpu will try to start the services in a multi tasking manner ie some services will start together and some services will start other services before it start as a requiremnt

why you want to do that? possibly there is an alternative way to achieve your requirement

cheers
0
 
LVL 6

Author Comment

by:sstouk
Comment Utility
The reason being is that I need to lower the priority of some services when they start and increase the priority of other services when they start, if that makes any sense.
There is a START command which can do it, but for the applications. I am looking for a similar way to start services.
Thank you for your attention to this question.

0
 
LVL 16

Expert Comment

by:ahmedbahgat
Comment Utility
ok you can start any service by using

NET START MyService Name

possibly you can create a batch file that include the the above command, and run it by putting it in the Startup folder, this may put cause it to start after other services has started

cheers
0
 
LVL 6

Author Comment

by:sstouk
Comment Utility
The question was  how to start the service and specify its priority.
I can start any service either with "net.exe START Servicename" or by just starting it through the GUI interface within the Service namager, that is not the question.

ahmedbahgat, you are confusing the START option of  cmd.exe  with START option for net.exe executables.

net.exe START 'Service Name'  - does not have an option to change the service priority.

cmd.exe START 'command' -  does have this option, but cannot be used with the Service (unless the service is registered with the regsvc.exe and is a regular executable file).

I could use:
cmd.exe START /LOW "mycommand.exe" to start the application "mycommand.exe" with low priority.
Again,
How to Start the Service Like this?

Noone has provided yet even a slightest clue here for a simply phrased and straightforward question.
I cannot say that the question is that simple, it is difficult, because it might not be even possible to do this, but if this is not possible, can anyone prove it?
Answering "Not Possible"  with some proof or a reference to some microsoft or any other general source would be considered a valid answer as well.






0
 
LVL 16

Expert Comment

by:ahmedbahgat
Comment Utility
hey mate there is something I'm sure about, which is I'm not confused with the service start button in the GUI and the net start command

I know that they are identical and the only difference is the GUI, however what I was trying to do is a workaround, to try to delay the service to start, in another way making it low priority

and because when the OS starts, it start the services listed in the services applette automatically and slightly in any order unless a service is dependant on another and in this case, if we try to start the service in a batch file that will be executed when the user login ONLY  and not before that, however the other services will not wait for the user to logon to start,

ie we are trying to isolate the service you want to delay in a batch file command and ONLY be executed when the user logon and this can be done by putting this file in the startup folder


cheers
0
Integrate social media with email signatures

Is your company active on social media? Do you also use email signatures? Including social media icons in your email signature is a great way to get fans for free. Let all your email users know you’re on social media quickly and easily, in a single click.

 
LVL 16

Expert Comment

by:ahmedbahgat
Comment Utility
I found an MS article on how to delay a service start, this may be the solution for yo:

http://support.microsoft.com/default.aspx?scid=kb;en-us;193888

cheers
0
 
LVL 16

Expert Comment

by:ahmedbahgat
Comment Utility
ok maybe your request is not what I understand, if you meant by priority is the CPU gain after the service starts, then I'm wrong, if you meant just to delay its start untill other services has started, then the link above is the way to go

cheers
0
 
LVL 6

Author Comment

by:sstouk
Comment Utility
Oh, I see now.
That was the reason....
In the question I mean priority of the service, not order of when it starts.
'Priority' is a thread priority, one Service should have more CPU time than the other.
As I explained, similar to the 'START' option when initialing an application from the batch file.
"cmd.exe START /LOW myapp.exe"
The above command will start myapp.exe with a LOW priority.
How to do it with the Service?
0
 
LVL 16

Expert Comment

by:ahmedbahgat
Comment Utility
sstouk, I had an extensive look at all the registry settings regarding a few servies I have on my machine, and could not find in settings that will set the cpu priority

I'm thinking of one possibilty, some services use an exe file, which can run on its own without being a service for example this file "PervasicveSQL.exe"  is an executable file to run the Pervasive SQL Desktop Edition that Accpac accounting software use

every time we have a power failure, the UPS shuts the machine down and when power comes it turns it on again, however the computer will only boot to the screen "Press CTR ALT DELETE to logon"

this was absolutly no good because, the PervasicveSQL.exe was not running as service, the file was in the Startup folder, ie it will only run when I logon to the server, the side effect will be the accounts software will not run untill I logon, and if i'm not there "I'm the whole IT department"  no one can use Accpac

contacted the accpac company and asked why I can not run PervasicveSQL.exe as service, they said that I need to buy the full server edition and not the desktop edition, a high cost was associated so I declined

went back and search the internet and managed to find an article on how to run PervasicveSQL.exe desktop edition as a service, pestro, it worked great

from the work I did regarding PervasicveSQL.exe to run as a service i found that there is a lot of things to do and not just running the exe file on its own

so I'm thinking of reversing the operation if this service you want to control is an exe file, and I meant by reversing the operation is to try to run that exe as an exe and not as a service, then we can use the CMD command with the required option as you suggested to control the cpu priority

I do  not know how yet but I will keep searching, possibly you may need to check out what exe file is associated with this service if any as frankly I found many services do not use an executable file at all

cheers
0
 
LVL 5

Expert Comment

by:gabit25
Comment Utility

You can use this registry entry that is not present by default to change a process (service) default thread priority. This is an example for the server service.


Key: HKEY_LOCAL_MACHINE\System\CurrentControlSet\ Services\LanmanServer\Parameters\
Data type: REG_DWORD
Values: 0 | 1 | 2 | 15
Default: not present in Registry.
Description: This entry controls the priority increase of the Server service threads.

Gabriel
0
 
LVL 5

Expert Comment

by:gabit25
Comment Utility
pay attention that 15 value is Real Time that could block your system ...
0
 
LVL 5

Accepted Solution

by:
gabit25 earned 400 total points
Comment Utility
Escuse me: most important thing : you have to add ThreadPriority entry as REG DWORD and value between 0- 15
0
 
LVL 6

Author Comment

by:sstouk
Comment Utility
That was exactly what I was asking for.
Thank You.
0
 

Expert Comment

by:volkb79
Comment Utility
...but using HKEY_LOCAL_MACHINE\System\CurrentControlSet\ Services\<YourServer>\Parameters\
 does not work for an ARBITRARY service, right? i tried it e.g. with WinVNC4 and it did not work.

i would like a service to be started by windows, be running without being logged in and running at a custom priority.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now