Solved

NT Service priority

Posted on 2000-04-05
5
255 Views
Last Modified: 2013-12-03
My question is basically simple - do programs running as services under Windows NT 4 run at a higher priority than programs running normally?

We have a program that sits in the background, looping around, checking some values in a database every second or so. Sometimes it needs to run as a service, sometimes as a normal program. So we have a module for each, with the appropriate code in the service module to register it and so forth - but the REAL code is all identical. The problem is, when we run the normal program, it takes about 10% CPU - fine, about what we expected. But the service, when started, settles on around 80% CPU - yet they're both executing the same code. We're pretty lost - any suggestions?
0
Comment
Question by:tofff
5 Comments
 
LVL 15

Expert Comment

by:NickRepin
ID: 2686637
Call GetPriorityClass and GetThreadPriority in both cases to be sure about the priorities.
0
 
LVL 15

Expert Comment

by:NickRepin
ID: 2686640
Also GetThreadPriorityBoost.
0
 

Author Comment

by:tofff
ID: 2686704
Thanks, but I don't WANT to boost any thread's priority...I want the service thread to run at the same priority/CPU usage as the normal program. Through third-party applications, it SEEMS as though both threads when they run have teh same priority...but I'm not sure.
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 2686915
>>do programs running as services under Windows NT 4 run at
>>a higher priority than programs running normally?

The answer to this very question is: No, they don't - you can easily check this by viewing the process' (base) priority using the task manager.

However, a service faces some other ramifications that a 'normal' program doesn't, e.g. SCM control requests (wich all require calling 'SetServiceStatus()'), security checks and so on.

A more specific answer to the problem that you're facing requires some more information about what the service/program actually does, so feel free to ask!
0
 
LVL 2

Expert Comment

by:DKostov
ID: 2687820
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

863 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

23 Experts available now in Live!

Get 1:1 Help Now