473,385 Members | 2,210 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,385 software developers and data experts.

Problems with CPU usage

We are developing applications in VB.Net which might be very CPU intensive. Our problem is that other applications running on the same machine is barely getting any processor resources at all. This is especially problematic when running our application on a terminal server. Other users running other applications on the terminal server feel the server stops responding

Do you have any good solutions to restrict processor usage to an application
Should we e.g. run Doevents in CPU intensive loops or should we set down the process priority
However, if the CPU is not being used by other applications/processes we want to be able to use all the available CPU resources we can get hold of

Jul 21 '05 #1
7 3474
Hi,

Try this:
using System.Diagnostics;
....
Process.GetCurrentProcess().PriorityClass =ProcessPriorityClass.BelowNormal;

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Falnes" <an*******@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com...
We are developing applications in VB.Net which might be very CPU intensive. Our problem is that other applications running on the same
machine is barely getting any processor resources at all. This is especially
problematic when running our application on a terminal server. Other users
running other applications on the terminal server feel the server stops
responding.
Do you have any good solutions to restrict processor usage to an application? Should we e.g. run Doevents in CPU intensive loops or should we set down the process priority? However, if the CPU is not being used by other applications/processes we want to be able to use all the available CPU resources we can get hold of.

Jul 21 '05 #2
Hi,

Try this:
using System.Diagnostics;
....
Process.GetCurrentProcess().PriorityClass =ProcessPriorityClass.BelowNormal;

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Falnes" <an*******@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com...
We are developing applications in VB.Net which might be very CPU intensive. Our problem is that other applications running on the same
machine is barely getting any processor resources at all. This is especially
problematic when running our application on a terminal server. Other users
running other applications on the terminal server feel the server stops
responding.
Do you have any good solutions to restrict processor usage to an application? Should we e.g. run Doevents in CPU intensive loops or should we set down the process priority? However, if the CPU is not being used by other applications/processes we want to be able to use all the available CPU resources we can get hold of.

Jul 21 '05 #3
Hi Falnes,

In addition to Miha,

Threading.Thread.Priority = Threading.ThreadPriority.BelowNormal

Cor
Jul 21 '05 #4
Hi Falnes,

In addition to Miha,

Threading.Thread.Priority = Threading.ThreadPriority.BelowNormal

Cor
Jul 21 '05 #5
Very hard to tell. Why is it CPU intensive in the first place, what exactly
are you doing in the loop, how long does it takes to run the whole loop?
Anyway, long running CPU intensive tasks should stay away from TS sessions ,
unless you can afford an SMP machine and run that task with CPU affinity.
Now, I assume this is a windows forms program, and the CPU intensive part
runs on a separate thread (I could be wrong because you are refering to
DoEvents). In that case you could try to change that thread's priority to
"below normal".

Willy.
"Falnes" <an*******@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com...
We are developing applications in VB.Net which might be very CPU
intensive. Our problem is that other applications running on the same
machine is barely getting any processor resources at all. This is
especially problematic when running our application on a terminal server.
Other users running other applications on the terminal server feel the
server stops responding.

Do you have any good solutions to restrict processor usage to an
application?
Should we e.g. run Doevents in CPU intensive loops or should we set down
the process priority?
However, if the CPU is not being used by other applications/processes we
want to be able to use all the available CPU resources we can get hold of.

Jul 21 '05 #6
Very hard to tell. Why is it CPU intensive in the first place, what exactly
are you doing in the loop, how long does it takes to run the whole loop?
Anyway, long running CPU intensive tasks should stay away from TS sessions ,
unless you can afford an SMP machine and run that task with CPU affinity.
Now, I assume this is a windows forms program, and the CPU intensive part
runs on a separate thread (I could be wrong because you are refering to
DoEvents). In that case you could try to change that thread's priority to
"below normal".

Willy.
"Falnes" <an*******@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com...
We are developing applications in VB.Net which might be very CPU
intensive. Our problem is that other applications running on the same
machine is barely getting any processor resources at all. This is
especially problematic when running our application on a terminal server.
Other users running other applications on the terminal server feel the
server stops responding.

Do you have any good solutions to restrict processor usage to an
application?
Should we e.g. run Doevents in CPU intensive loops or should we set down
the process priority?
However, if the CPU is not being used by other applications/processes we
want to be able to use all the available CPU resources we can get hold of.

Jul 21 '05 #7
Thank you very much for your reply
It takes several hours to run the whole loop, and some customers need to run it on a TS session
Yes it is a Windows forms program, but it doesn't run on a separate thread. Do you recommend running on a separate thread? If I were to run on the main thread, is it possible to set the main thread's priority to below normal? Is it no use in using DoEvents

Regards, Falnes

----- Willy Denoyette [MVP] wrote: ----

Very hard to tell. Why is it CPU intensive in the first place, what exactly
are you doing in the loop, how long does it takes to run the whole loop
Anyway, long running CPU intensive tasks should stay away from TS sessions ,
unless you can afford an SMP machine and run that task with CPU affinity
Now, I assume this is a windows forms program, and the CPU intensive part
runs on a separate thread (I could be wrong because you are refering to
DoEvents). In that case you could try to change that thread's priority to
"below normal"

Willy
"Falnes" <an*******@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com..
We are developing applications in VB.Net which might be very CPU
intensive. Our problem is that other applications running on the same
machine is barely getting any processor resources at all. This is
especially problematic when running our application on a terminal server.
Other users running other applications on the terminal server feel the
server stops responding
Do you have any good solutions to restrict processor usage to an

application
Should we e.g. run Doevents in CPU intensive loops or should we set down
the process priority
However, if the CPU is not being used by other applications/processes we
want to be able to use all the available CPU resources we can get hold of

Jul 21 '05 #8

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

Similar topics

5
by: Justice | last post by:
Currently I'm doing some experimenting with the XMLHTTP object in Javascript. Now, the XMLHttp object is asynchronous (at least in this case), and the following code causes a significant memory...
2
by: Karthik | last post by:
hi everyone, I am using getopt_long() in one of my programs to parse out the command line arguments. The library call returns a character code of "1" which i am not sure whether it is a errno...
1
by: Bryan Olson | last post by:
Yesterday I embarrassed myself on sci.crypt with some incorrect C code and corresponding claims about the language. My source was Harbison and Steele (H&S), /C, A Reference Manual/ and I thought...
16
by: JCauble | last post by:
We have a large Asp.net application that is currently crashing our production servers. What we are seeing is the aspnet_wp eat up a bunch of memory and then stop unexpectedly. Does not recycle. ...
3
by: Jeff | last post by:
I've been working on an application for a while now that has been giving me some trouble when it comes to working with a picturebox and memory usage. My company deals with digital imaging, so we...
10
by: Doug | last post by:
If I am grabbing a lot of rows (say 10,000 from SQL) would I be helping or hurting the network by using a DataReader? I would think helping because it's really only returning 1 row at a time,...
5
by: hamishd | last post by:
Hello, In my application I create some large vectors to hold data. For example: std::vector<DataItemClass*MyData; DataItemClass * DataItem; for(i=0;i<SomeLargeLimit;i++){ DataItem = new...
9
by: Kelii | last post by:
I've been trying to get this piece to work for a few hours, but have given up. I hope someone out there can help, I think the issue is relatively straightforward, but being a novice, I'm stumped....
8
by: mickey22 | last post by:
Hi all, I am trying to compile a VC++ project and it is win32 console application.When I try to compile it I get a lot of linking problems.I have included all the header files needed for the...
409
by: jacob navia | last post by:
I am trying to compile as much code in 64 bit mode as possible to test the 64 bit version of lcc-win. The problem appears now that size_t is now 64 bits. Fine. It has to be since there are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.