Solved

NT Service priority

Posted on 2000-04-05
5
261 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…

734 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