>>Given two programs, one running at normal priority, the other at the
>>lowest possible priority (idle priority), the second program will get
>>around 1-2% of the CPU,
>
>I noticed the same thing under Linux (with rc5des). Idle processes get a
>few % cpu time even on perfectly busy systems.

You might check to see if the higher priority CPU bound tasks have invoked any
page-faults.  If they have to wait for page-in activity, then there will be
some small amount of idle time for the lower priority task.


>Perhaps the turn-around time of the task switcher could be used to
>identify a busy system and yield immediately if neccesary.
>I.e. get the Pentium CPU-clock cycle count upon time slice exit (is that
>possible?) and next time our program becomes active, compare new value
>to old and yield if the turn-around time was more than a few
>milliseconds. This would reduce the CPU load of our program to nearly
>zero if the system is busy with other tasks.

before trying any complex schemes like this, I'd suggest using simple
stopwatch timing of the  normal priority tasks with and without the idle
priority CPU job running in the background.  If the results are within a % or
two, I wouldn't worry about it.

-jrp


Reply via email to