[Coco] CPU utilization calculation in NitrOS-9

Johann Klasek johann+coco at klasek.at
Mon Jan 25 10:20:47 EST 2021


On Mon, Jan 25, 2021 at 04:15:25AM -0500, Jeff Teunissen wrote:
> On Sun, Jan 24, 2021 at 9:00 PM William Carlin <whcarlinjr at gmail.com> wrote:
[..]
> I'm not sure your assumption is correct. Unlike more modern CPUs, the
> 6x09 CPUs don't have low-power or throttling modes, so there's not
> really any kind of "idle" state. Even if _all_ the processes have put
> themselves to sleep, the kernel scheduler is furiously polling devices
> and going through the task list looking for a process to wake up or
> run.
> You could call that scheduler time "idle" for the purpose of measuring
> how much time the processes are being given, but it's not really idle
> in the usual sense of "system not doing anything".

However in OS theory the utilization of a system does not depend on what
the system (kernel) is doing during "idle time". Idle has the meaning of
time not consumed by any task for a given interval. There is no
difference if the CPU is an old or of some modern kind.
It should represent the ratio of the time user tasks consume (including
system overhead like context switch time) to the whole duration of a
given interval. It can be imagined if there would be an explicit lowest
priority idle task, with runs only if no other task has to do anything,
even though this idle task is permanently busy with system
housekeeping...

For instance, Unix defines the "load" with the avarage number of
processes which are in "running" state for a given interval. 0 means the
there no process needs the CPU even though the system is working on its
internal datastructures. With load of 1 the CPU is saturated, everything
above 1 means that more processes are waiting for the CPU than the CPU
can actual handle.

Would it be possible to collect such information (the length of the
kernel's active-task-queue and the time reference if this value is
changing)? I think this has to be a part of the scheduler itself, but
AFAIK OS-9 Level I or II does not provide such information.



More information about the Coco mailing list