Re: setleds

David A Rusling (rusling@linux.reo.dec.com)
Fri, 18 Apr 1997 16:24:00 +0000


> Why does 'setleds' suck all cpu when it can?
>
> Ie. a script running 'setleds' in an endless loop (as a normal user)
> makes the computer almost unusable, because other processes are not
> scheduled often.

Assuming that setleds makes system calls to write to a serial device...

Say you have N processes and one of them is running setleds. Every time the
setleds process gets to run it will be busy (making system calls to change
the leds). The setleds process probably consumes all of its timeslice. If
any one of the other processes runs, it probably does not consume all of its
timeslice, maybe it has to wait for an inode from the disk or it has to
wait for its turn to access some critical data structure (again probably
file system based).

Assuming that the system is doing reasonably fair round robin scheduling this
means that the setled process is taking more than 1/N'th of the CPU cycles of
the system. It is always ready to run and when it runs, it runs to completion.

Alternatively, as the process context switch happens on exit from any
system call, maybe setleds is making _long_ system calls.

Dave

----------------------------------------------------------------------
David A Rusling Principal Engineer
European Semiconductor Applications Digital Equipment Co Ltd.,
Engineering PO Box 121,
Imperial Way,
Worton Grange
Reading RG2 0TU
Linux, Alpha, StrongArm, PCI Tel: UK-(0)1734-204380
Fax: UK-(0)1734-203133
----------------------------------------------------------------------