Solved

NT Service priority

Posted on 2000-04-05
5
254 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
Comment Utility
Call GetPriorityClass and GetThreadPriority in both cases to be sure about the priorities.
0
 
LVL 15

Expert Comment

by:NickRepin
Comment Utility
Also GetThreadPriorityBoost.
0
 

Author Comment

by:tofff
Comment Utility
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
Comment Utility
>>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
Comment Utility
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

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

16 Experts available now in Live!

Get 1:1 Help Now