|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Control the CPU Utilization during Application Execution written C#.NetThis 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. Well you set the thread's priority to BelowNormal / Lowest.
Alternatively do not execute tight loops and call Thread.Sleep(milliseconds) 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. > > 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 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 > 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) 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 > > 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 > |
|||||||||||||||||||||||