Solved

NT Service priority

Posted on 2000-04-05
5
262 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

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