Re: CPU usage, memory and virtual memory
- From: "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
- Date: Wed, 06 Apr 2005 17:06:55 -0500
Syj wrote:
Hello,
On certain occasions, some applications can consume close to 100% cpu usage and freeze up the machine. But some apps can consume 100% cpu, but allow you to work on other applciations. What is the difference? Is it the memory and virtual memory consumption? Number ofpage faults?
I am working on a multithreaded MFC application, which freezes up the machine (when it does some computations). A look at the task manager tells me it consumes 99% cpu and a lot of memory and virtual memory space. I would like to make sure that when my applciation computes, it does it as fast as possible and it does not interrupt the user from working on other applications (all real time apps). How do I solve the problem? Either make sure that CPU usage does not hit say more than 70%? or let the cpu hit the maximum (so that computation is done fast), but still does not freeze the machine.? and what are the steps should I take to solve either of this? IS there a better newsgroup to post this question?
As you see, I have a very weak understanding of the workings of the
operating system in this reagard. Some explanatory help in what ways
can I go in solving the current problem would benefit me.
Thank you
Review the code for calls to SetThreadPriority and/or SetPriorityClass. The machine will remain responsive to the user, even when your code wants to consume 100% of the CPU, if you lower the appropriate thread priority to BELOW_NORMAL_PRIORITY_CLASS or IDLE_PRIORITY_CLASS. The basic policy provided by the OS is that the highest priority thread gets what it wants - to the extent possible.
-- Scott McPhillips [VC++ MVP]
.
- Prev by Date: Re: Rounding in VC++6
- Next by Date: Re: CSocket, best way to wait for a reply?
- Previous by thread: CSocket, best way to wait for a reply?
- Next by thread: Problem downloading Activex control
- Index(es):
Relevant Pages
|
Loading