Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Computer Information (http://www.velocityreviews.com/forums/f41-computer-information.html)
-   -   Re: System Idle Process (http://www.velocityreviews.com/forums/t741694-re-system-idle-process.html)

Paul 01-08-2011 12:25 AM

Re: System Idle Process
 
James D Andrews wrote:
> Windows XP SP 3
>
> I'm trying to fully grasp the role of System Idle Process and what it can
> reveal about what's happening.
>
> After reading up yesterday, I got the impression that (in the most
> simplistic terms) System Idle Process fills in the blanks when no other
> processes are running and that it is not uncommon for it to grab a big chunk
> of CPU to do this.
>
> Now, when another process is called on, shouldn't System Idle Process
> relinquish control over this asset, drop off and allow the new command to
> take over?


You're correct, in that the intention is, when no other task
is "ready to run", the System Idle task is scheduled instead.

The part you're missing, is the System Idle task has very
few instructions in it. It might do some trivial stuff for
bookkeeping purposes, and then it issues a Halt instruction.

This stops instruction execution, until the next interrupt
signal comes from hardware. The clock tick interrupt, used
by the scheduler, is just one flavor of interrupt signal.
Any interrupt, such as a LAN packet arriving while Idle
is running, will wake the system again and continue
operation. The system can't micro-sleep, for longer than one
clock tick. If the Idle is executed during the next
interval, then a few microseconds later, the system is
in another micro-sleep.

So the Idle task doesn't hurt anything. On the surface,
it would appear to be a bookkeeping artifact. But because
of its usage of the Halt instruction, it also saves electricity.

Paul

Jeff Strickland 01-09-2011 12:19 AM

Re: System Idle Process
 

"Paul" <nospam@needed.com> wrote in message
news:igat26$39m$1@news.eternal-september.org...
> James D Andrews wrote:
>
>>
>> Thanks.
>> So if I try to open a window, should the process for that window (windows
>> explorer for instance) start running and System Idle drop out (more or
>> less)?
>>

>
> System Idle gives way to anything else which is ready to run, so
> when you attempt to run Explorer, Explorer will win and get the cycles.
> You don't have to worry about System Idle stealing your performance.
> All the performance is available to regular programs.
>
> Paul



I'm not sure I have this right, but I'm reading that the CPU runs at 100%.
Processes take up whatever percentage of the CPU time as they might need,
and the System Idle uses the remainder. So, if running processes use 16%,
then System Idle Process will use 84%. A new process comes along and wants
4%, so the System IdleProcess will drop to 80% so the actively running
processes can take 20% -- the 16 that was already being used plus the new
demand of 4.

As demands are placed on the CPU, System Idle Process will give up some
portion so that the demands and the idle always total 100%.

That's interesting, I did not know it worked that way. Am I getting it
right?

I think I follow the logic -- the capacity is what it is, and it always is
100%. The idle process is merely the filler stuff that acts sorta like
ballast. When Task Manager is reporting 2% of the CPU is being used, this
means 98% of the processing capacity is free, and the System Idle Process is
just keeping the CPU busy at that moment. System Idle usage is constantly
changing as demands on the CPU come and go.






Paul 01-09-2011 09:08 AM

Re: System Idle Process
 
Jeff Strickland wrote:
> "Paul" <nospam@needed.com> wrote in message
> news:igat26$39m$1@news.eternal-september.org...
>> James D Andrews wrote:
>>
>>> Thanks.
>>> So if I try to open a window, should the process for that window (windows
>>> explorer for instance) start running and System Idle drop out (more or
>>> less)?
>>>

>> System Idle gives way to anything else which is ready to run, so
>> when you attempt to run Explorer, Explorer will win and get the cycles.
>> You don't have to worry about System Idle stealing your performance.
>> All the performance is available to regular programs.
>>
>> Paul

>
>
> I'm not sure I have this right, but I'm reading that the CPU runs at 100%.
> Processes take up whatever percentage of the CPU time as they might need,
> and the System Idle uses the remainder. So, if running processes use 16%,
> then System Idle Process will use 84%. A new process comes along and wants
> 4%, so the System Idle Process will drop to 80% so the actively running
> processes can take 20% -- the 16 that was already being used plus the new
> demand of 4.
>
> As demands are placed on the CPU, System Idle Process will give up some
> portion so that the demands and the idle always total 100%.


But the System Idle isn't making this decision. Every OS has a scheduler,
and it is the job of the scheduler, to decide what runs, and when. The
scheduler supports "time sharing", such that many processes get a
tiny slice of time each. it so happens, that the System Idle, has
a very low priority, so low, that all other processes get to go
first. And that is how things automatically adjust to the level of
demand. As more demanding things show up, Idle gets fewer chances
to run. And it's a function of the operation of the Scheduler.

>
> That's interesting, I did not know it worked that way. Am I getting it
> right?
>
> I think I follow the logic -- the capacity is what it is, and it always is
> 100%. The idle process is merely the filler stuff that acts sorta like
> ballast. When Task Manager is reporting 2% of the CPU is being used, this
> means 98% of the processing capacity is free, and the System Idle Process is
> just keeping the CPU busy at that moment. System Idle usage is constantly
> changing as demands on the CPU come and go.


If you want to try some experiments, there are a couple programs you can try.
Note - depending on your Antivirus software, some AV programs don't like
this kind of stuff. I've had Kaspersky lock up my computer, when running
half the programs available from Sysinternals. So if you've got a lot of
AV software running, then be warned there could be a lockup.

1) Task Manager

If you right click on a process in Task Manager (control-alt-delete),
there is an option in the menu to "Set Priority". This feature should be
used with caution. For example, if you run two normal programs, they
get 50% of the processor each. If you increase the priority of one of
the programs "by one notch", then you may find the higher priority
program is 75%, the other program 25%. (This would be the special
situation, where both programs would run at 100% if they could, but
have to share nicely as there aren't enough resources.) That would be a
usage for process priorities - it can be a way of assigning more time to one
process. But, if you set it too high, your program ends up higher than
some of the system functions, and then there could be a lockup.

If you do this experiment, notice that "System Idle" has a priority of
"N/A" or Not Applicable. That tells you that as far as Task Manager
is concerned, they don't want you modifying System Idle :-)

2) Process Explorer from Sysinternals

http://technet.microsoft.com/en-us/s...rnals/bb896653

That program, in View : Select Columns, then Process Performance tab,
has a "Base Priority" tick box. When selected, that will display the
numeric value of Priority. System Idle is 0, ordinary programs like
Firefox or Explorer are 8, and the Process Explorer program runs
at 13. Since Process Explorer is intended to function much like
Task Manager, it runs at a high priority, so other programs can't
lock it out. (And the author of Process Explorer, knows how to
write the code, so his program won't lock the computer. Other
programs aren't written to take high runtime priorities into
account.)

So Process Explorer says System Idle runs at zero, but we don't
really know if that is the actual number being used. That is
what Process Explorer chooses to display. (And Mark is an honest
guy, so I tend to believe it's actually zero.)

4) The third toy to play with, is RMClock. The ZIP version is easy to
download and unzip.

(RMClock download page "RMClock Utility 2.35")

http://cpu.rightmark.org/download.shtml

You can run your own Idle task, by clicking "Run HLT command
when OS is idle". That option is shown in the picture here.

http://winhlp.com/images/rmclock2.png

The package has a piece of code called RMClockHLT. There should be
one launched per core of your processor (you look in Task Manager,
after a reboot, for them). The priority of that thing, should be low.
(I'm not going to check it now, so it can be your experiment.) As
far as I know, it runs lower than System Idle.

Now, the funny side effect from running that, is if you use
Task Manager, the graphs stay at 100%, all the time.
Yet, the computer is responsive, and does just exactly as much
work for you, as before.

The reason that happens, is running RMClockHLT, breaks the
bookkeeping function that was provided by System Idle. Since
System Idle is no longer the lowest priority task, the running
of System Idle is no longer a predictor of how often the
system was idle.

But the bookkeeping done by the RMClockHLT process, is used
by the RMClock program. And the colorful graphs in RMClock,
will show the system utilization is actually zero. Even though
Task Manager now has the "false" 100% graph. So now, the RMClock
program, is the only one with an accurate picture of how idle
the computer is.

So that is an example, of what happens when the priorities
aren't all stacked up the way the system expects.

You might ask, why was I running RMClock in the first place, and
why did I tick that box and do the experiment ?

Back a couple years ago, I used to run Kaspersky AV. Many AV programs,
"hook" into everything. Kaspersky is interested, for example, in
how many times a certain random number generator is called
(I even did an online chat with their tech support, and couldn't
get an answer about that one). Kaspersky also replaces System Idle.
It runs a version without a HLT instruction. That raised the power
consumed by my computer, by 10-20 watts.

To fix that, for the remainder of my Kaspersky subscription, I
started running RMClockHLT regularly. Since that Idler process
uses a HLT instruction, unlike the thing Kaspersky screwed up,
my system went back to running cool again. By using a Halt
instruction, the computer "micro-sleeps" until the next
scheduler clock tick.

The reason I started investigating that in the first place,
is I was working behind the computer one day, and noticed
the exhaust air was warm. Warmer than it should be. And I
said to myself, "that's not right, WTF is going on here". This
was sometime after installing Kaspersky. And the experiments went
from there. (I used a clamp-on DC ammeter, to monitor my processor.
I knew the reading was supposed to be 13.2W, or 12V @ 1.1A at idle,
and it was no longer that low.) I haven't used Kaspersky in a while now,
and no longer need to use that hack, but it was fun at the time.
And the PC did run cooler, because I had a working HLT, and the
computer could micro-sleep when it wasn't busy.

Did that defeat some security feature of Kaspersky ? I'll
never know :-)

HTH,
Paul


All times are GMT. The time now is 05:22 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.