Home All Groups Group Topic Archive Search About

Control the CPU Utilization during Application Execution written C#.Net

Author
26 Apr 2007 7:22 AM
apondu
Hi,

This is Govardhan, i am working on C#.Net.

I have a problem and i am sure most of them would have come across
this

problem. I have written a application in C#.Net. It does lot of work
so i know

it'll take time for the execution. But my problem is it starts
utilizing 98 to

100% of the CPU. I needed to know is there any way where in i can
control the

amount of CPU utilization for my application and restrict it to use
say some 60

-70% of the CPU. Actually when it starts utilizing 98 to 100% of the
CPU, i get

a feel that my system is hung-up, so i wanted to avoid this.

Is there any other solution to this problem.

If someone knows the solution for this problem then can u share it.

I am waiting for the response, this is my mail-id apo***@gmail.com

Thanks for the help and suggestions.

Regards,
Govardhana.

Author
26 Apr 2007 12:26 PM
Hermit Dave
Well you set the thread's priority to BelowNormal / Lowest.

Alternatively do not execute tight loops and call Thread.Sleep(milliseconds)

--
Regards,

Hermit Dave
http://www.invokeit.co.uk


Show quote
"apondu" wrote:

> Hi,
>
> This is Govardhan, i am working on C#.Net.
>
> I have a problem and i am sure most of them would have come across
> this
>
> problem. I have written a application in C#.Net. It does lot of work
> so i know
>
> it'll take time for the execution. But my problem is it starts
> utilizing 98 to
>
> 100% of the CPU. I needed to know is there any way where in i can
> control the
>
> amount of CPU utilization for my application and restrict it to use
> say some 60
>
> -70% of the CPU. Actually when it starts utilizing 98 to 100% of the
> CPU, i get
>
> a feel that my system is hung-up, so i wanted to avoid this.
>
> Is there any other solution to this problem.
>
> If someone knows the solution for this problem then can u share it.
>
> I am waiting for the response, this is my mail-id apo***@gmail.com
>
> Thanks for the help and suggestions.
>
> Regards,
> Govardhana.
>
>
Author
27 Apr 2007 9:47 AM
apondu
Hi,

I have done tht, even thn the cpu utilization is 100%. Is there any
other solution for this...

Thanks for the response

Regards,
Govardhana
Author
27 Apr 2007 9:52 AM
Henning Krause [MVP - Exchange]
Hello,

lowering the thread/process priority will not stop the process from using
all available cpu cycles. But if another program runs at a higher priority,
it will get relative more cpu cycles than your app.

Best regards,
Henning Krause

Show quote
"apondu" <apo***@gmail.com> wrote in message
news:1177667230.326214.87110@t38g2000prd.googlegroups.com...
> Hi,
>
> I have done tht, even thn the cpu utilization is 100%. Is there any
> other solution for this...
>
> Thanks for the response
>
> Regards,
> Govardhana
>
Author
27 Apr 2007 10:56 AM
Hermit Dave
As Henning said, using thread priority is not going to stop 100% CPU usage.
It just means that if there is any other thread / program that is running at
a higher priority then it will get precedence.

The only other thing is to make sure you do not use tight loops and use
Thread.Sleep(timeInMilliseconds)
--
Regards,

Hermit Dave
http://www.invokeit.co.uk


Show quote
"apondu" wrote:

> Hi,
>
> I have done tht, even thn the cpu utilization is 100%. Is there any
> other solution for this...
>
> Thanks for the response
>
> Regards,
> Govardhana
>
>
Author
1 May 2007 10:06 AM
Guillaume Charhon
Maybe if you change the priority of the actual thread, it can solve your
problem...

Regards.

apondu a écrit :
Show quote
> Hi,
>
> I have done tht, even thn the cpu utilization is 100%. Is there any
> other solution for this...
>
> Thanks for the response
>
> Regards,
> Govardhana
>

AddThis Social Bookmark Button