473,387 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Setting thread priority to low(est)

I have a couple of small single-thread Console utilities doing cpu-intensive
stuff. Is there an easy way to set the program execution priority to LOW
from within the program ? Now I pause the things first and invoke
TaskManager and manually set the priority... A bit cumbersome.
Nov 15 '05 #1
3 6931
MJB
I don't think there is. You may want to execute the worker code in a
separate thread; that way you can control the priority. Good luck.
"Stu Banter" <x2**************@westerterp.com> wrote in message
news:3f***********************@news.xs4all.nl...
I have a couple of small single-thread Console utilities doing cpu-intensive stuff. Is there an easy way to set the program execution priority to LOW
from within the program ? Now I pause the things first and invoke
TaskManager and manually set the priority... A bit cumbersome.

Nov 15 '05 #2
Use the Process class to GetCurrentProcess. Then use that process's
public property PriorityClass to set the priority of the process.

"Stu Banter" <x2**************@westerterp.com> wrote in message
news:3f***********************@news.xs4all.nl...
I have a couple of small single-thread Console utilities doing cpu-intensive stuff. Is there an easy way to set the program execution priority to LOW
from within the program ? Now I pause the things first and invoke
TaskManager and manually set the priority... A bit cumbersome.

Nov 15 '05 #3
Hi,

Take a look at Process class, here you have a PriorityClass property that
you may use for it.

Also try this line:
Thread.CurrentThread.Priority = ThreadPriority.BelowNormal;
Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Stu Banter" <x2**************@westerterp.com> wrote in message
news:3f***********************@news.xs4all.nl...
I have a couple of small single-thread Console utilities doing cpu-intensive stuff. Is there an easy way to set the program execution priority to LOW
from within the program ? Now I pause the things first and invoke
TaskManager and manually set the priority... A bit cumbersome.

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: John | last post by:
Hello. If I want to set up my first database and start using it in Dreamweaver what do I need to do? The book I'm working on has a CD with the database on. It is telling me to put it in the...
3
by: John | last post by:
I have a package built in C#.Net. I have the deployment package all set. However, I have a file that needs to be installed in the project but I don't want it be overwritten by an older version of...
12
by: Eric Lindsay | last post by:
I'm trying to learn how to read a DTD I wanted to use, http://www.w3.org/TR/html4/strict.dtd to ensure I was treating each element correctly in terms of being block, inline, or flow (either). ...
3
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : ...
1
by: dbee | last post by:
So I can't figure out what exactly is going wrong here ... I'm using php4.3 I'm accessing a server in Dublin from Seoul. I need to be able to translate times into various timezones across the...
5
by: gesres | last post by:
I have some column headings whose widths are set via styles: <TR> <TD style="visibility:hidden;width:0px">&nbsp;</TD> <TD style="visibility:hidden;width:0px">&nbsp;</TD> <TD...
0
by: helloitsme | last post by:
Hello All! I know there already exists a thread with this topic by Mike! But my problem did not get solved with that.... I have a working code in VB6 that can set the selected timezone for the...
3
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
Hi, I have a web application that will be hosted on servers with timezones configured to EST with daylight saving. My application takes an XML datafeed that contains times in GMT (also with...
44
by: climber.cui | last post by:
Hi all, Does anyone have experience on the thread-safty issue with malloc()? Some people said this function provided in stdlib.h is not thread- safe, but someone said it is thread safe. Is it...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.