|
Thanks for the link, I didn't realise that the HLT was used dynamically in system idle.
I especially liked the link in hte article to the HCF - Halt and Catch Fire instruction[^], brought back some hardware memories.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
Try right-clicking "System Idle Process", and you won't see a popup menu. It's something like void .
Maxwell Chen
|
|
|
|
|
Hi Maxwell,
My question is not what the idle process is and I understand system is doing nothing in idle process. My question is what makes the idle process happen and even consume a non-neglectible percentage of CPU.
This is what I explained before.
--------------------
I am monitoring the performance of my C++ application. I see somethings there is a system idle process while my application is running. I want to know what reasons may cause the system into idle status -- this is the key point of my question (not what is, but what cause).
If CPU is in idle status because of waiting for some resources, I think I have found the bottleneck of performance.
--------------------
Do you have any ideas what will cause idle process to happen besides the case when there is nothing to do?
regards,
George
|
|
|
|
|
Hi George,
as long as there are CPU cycles consumed by the idle process, there is a good chance you
could improve your app's performance by revisiting the way it is structured and using
multi-threading. Basically threads offer the possibility to do some useful computation
while part of an app is waiting for something (say a file access, a network operation, ...).
Analogy: When you paint several rooms in parallel, you can paint one while another is
drying, with enough rooms, you will have to no idle time before everything got painted.
Once idle time is down to almost zero, there is not much you can gain from adding threads,
which does not necessarily mean you are running at maximum performance since
you may have selected a suboptimal algorithm, inserted a busy loop, etc.
Performance optimization is a very broad subject, some simple observations may give
a hint for quick wins. The idle percentage is one of them.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
modified on Tuesday, January 15, 2008 4:15:37 AM
|
|
|
|
|
Thanks Luc!
Great!
I want to confirm with you that you mean waiting for I/O (file, network) will make idle process happen and consume CPU time?
Luc Pattyn wrote: while part of an app is waiting for something (say a file access, a network operation, ...).
regards,
George
|
|
|
|
|
Hi George,
Each of the threads (of all processes taken together) is basically in one of two states:
- can proceed (often called "ready", which does not mean "done" here)
- can't proceed ("waiting" or "blocked")
ON A SINGLE CORE
Of all the ready threads one is actually running, that is the "current thread".
The idle process basically has one thread that never blocks, it is always ready but
has lowest priority, so if all other threads are blocked, then CPU cycles are spent
(or wasted) in the idle thread; if some other thread is ready, there would not be any
idle cycles.
ON AN N-WAY MULTI-CORE
same ideas, but now there are N "current threads", and the idle process holds N idle threads;
if fewer than N non-idle threads are "ready", the remaining cores will execute their idle
thread.
result: a single-thread app will only consume max 50% of available CPU cycles on a
dual-core. The other core may run threads from other apps, and if nothing is ready,
then it idles. Turning the single-threaded app into a dual-threaded app is likely to
improve the app's performance, and to lower the overall CPU's idle percentage.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Thanks Luc,
Do you think process waiting for I/O will cause system in idle, even if some process seems running (but actually waiting for I/O)?
For example,
1. Hard page fault cauing a lot of page swap I/O;
2. Waiting for network I/O;
3. Waiting for file I/O.
regards,
George
|
|
|
|
|
George_George wrote: Do you think process waiting for I/O will cause system in idle
As I said, a thread that is not ready (as in Thread.Sleep, ManualResetEvent.WaitOne, and
many many more), will cause the next-priority ready thread to run. If none are ready besides
the idle thread(s), then the system becomes idle until a thread becomes ready again
(because an I/O operation completed, or a delay expired).
The key word is "waiting": if a thread performs some I/O it does not necessarily wait,
e.g. most files accesses are buffered, so adding a char to a file stream is very likely to
be a simple memory operation most of the time; once the buffer is full, or some threshold
is exceeded, the stream may pass its buffer to the next level, say a software cache,
or the disk driver itself; if slow/physical devices get involved, a real wait is probable.
I am getting the impression you have some overall problem and are asking questions at
too low a level; it may be more useful if you explain your app, and the observations that
cause you to wonder about all this (unless it is just out of curiosity of course).
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Thanks Luc Pattyn,
My question is answered. Your patience is appreciated.
regards,
George
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
|
Does it has anything to do with my original question, what will cause idle process happen (I/O?)?
regards,
George
|
|
|
|
|
if you understand that Idle means Do Nothing , yes, it has to do !!!
|
|
|
|
|
Has to to what?
My question is about what makes idle process happen, not what is idle process.
Any ideas?
regards,
George
|
|
|
|
|
are you doing it voluntarily ?
no one make the Idle Process Happen. it is there as long as Windows runs. if it uses 100% of proc. time, then it's because no other application consumes the CPU. if you see full CPU usage in the task manager, then remark that the idle process uses 0% of the processor...
that's all, there's nothing more to know about it.
|
|
|
|
|
Thanks toxcct,
I agree no one knows exactly how will cause idle process. But this thread is used to discuss in what general scenarios, system idle process will happen.
Like we have discussed,
1. System is not doing anything;
2. Single thread on multi CPU;
3. I/O (network, file, etc.).
It is appreciated if you could add some more.
regards,
George
|
|
|
|
|
George_George wrote: Are there any other cases which will cause system idle process happen
It "happens" as a result of the other processes not doing anything (i.e., it's what they are not). In other words, if you sum the CPU Usage of all processes, subtract from 100, the result would be the System Idle Process. Of course, I'm sure you already knew this.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks DavidCrow,
I agree.
regards,
George
|
|
|
|
|
|
Looks great, Hamid!
Very helpful. If there could be the a list of reasons which will cause idle process to have a non-neglectible percentage will be better.
regards,
George
|
|
|
|
|
You're welcome.
|
|
|
|
|
I am trying to develop a COM executable which implements the functionality in the IHWEventHandler interface . I was unsure if the IDE supports creating a co-class implementing the functions defined in IHWEventHandler.
In other words , I started with a new ATL project , which creates the boiler-plate code for housing the COM object , however I was unsure as to how to add a CoClass ( that implements the functionality of IHWEventHandler) from within the IDE.
I have tried Add->ATL Object --> Simple Object , however I am not sure where and how I can specify ( from the IDE) that the new class that I create will derive from
public IHWEventHandler
Any help is appreciated.
|
|
|
|
|
Hi all,
I have a web application on Visual Studio 2005, Windows Xp Pro, and I want my web application to handle requests for JPG images, how can I set the configuration for the application to have my application receive and serve requests for JPEG files?
Thank you
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Hi,
i'm using the windows media player as activeX object in a C#
application. I want to change the "Video border color"
(Windows Media Player->Menu Tools->Options->Performance->Advanced)
in my application. I cannot find the right options in the msdn library
to change the color from my application.
It's because i want to change the background color of the media player
if a video is changed during playback.
Can please someone tell me how to to this?
regards,
Lucas
|
|
|
|
|
If your question is about C# you must ask on the correct forum because here VC++ forum.
|
|
|
|
|