High CPU usage

Last post 07-04-2009 2:24 PM by abdelnaby. 4 replies.

Sort Posts:

  • Crying [:'(] High CPU usage

    07-03-2009, 9:03 AM
    • Member
      2 point Member
    • usharaniP
    • Member since 07-03-2009, 12:59 PM
    • Posts 3

    Hi, I have developed a windows tool, which is occupying the high cpu usage while running. Sometimes other programs are being struck when running the tool. The tool does many process in the system. But i dont want to take more usage of CPU. Application is in final stage. Please provide solution for my problem.


    Thanks in Advance.

  • Re: High CPU usage

    07-03-2009, 10:25 AM
    • Participant
      1,066 point Participant
    • stevew1975
    • Member since 05-29-2009, 2:51 PM
    • Bristol, UK
    • Posts 189

    without knowing what you have developed it will be very difficult to provide a solution.

    a possible issues could be if you are running continues loops, the cpu usage will be high. 

    To get around this, you could convert this into a windows service with a timer to run every x seconds/minutes.  You could leave it as an application and run as a scheduled task to run every x seconds/minutes.




    Please mark this post as answered if it helped you!
  • Re: High CPU usage

    07-03-2009, 3:13 PM
    Answer
    • Star
      14,224 point Star
    • JeffreyABecker
    • Member since 10-04-2004, 8:27 AM
    • Philadelphia, PA
    • Posts 2,908

    Are you doing something that would be expected to be processor intensive?  Have you profiled your application and done Big-O analysis of your algorithms?

  • Re: High CPU usage

    07-04-2009, 12:47 PM
    Answer
    • All-Star
      62,723 point All-Star
    • TATWORTH
    • Member since 02-04-2003, 8:34 AM
    • England
    • Posts 12,239
    • TrustedFriends-MVPs

    Leaving aside the issue of efficiency, you can improve responsiveness to other applications on the PC by including a call to sleep for say 5 milli-seconds in your main loop.

    See http://msdn.microsoft.com/en-us/library/system.threading.thread.sleep.aspx

    If your application is WinForms, then it would have been best asked at:

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: High CPU usage

    07-04-2009, 2:24 PM
    Answer
    • Member
      40 point Member
    • abdelnaby
    • Member since 07-02-2009, 9:07 AM
    • Posts 8

    FIrst you have to move processor consuming processes to a seperate thread

    second you set the thread periorty to lowerst ( or better leave it as a user setting )

    3rd use threadpool.queueworkitem

    4th you can consider the background worker control

    consider upgrade CPU . this is a no-coding solution

    Mohamed Abdel Naby
    Senior asp.net developer
    Egypt
Page 1 of 1 (5 items)