SPS - a useful replacement for ps(1) (but....)

Robert Ward robert at hslrswi.UUCP
Thu Jul 4 05:43:58 AEST 1985


Sean Casey (sean at ukma.UUCP) points out that sps runs at nice -20
and hence runs fast at the expense of other users. He even goes on
to point out that typing "sps adefgvwr >/dev/null &" can have pretty
dire consequences for everyone else.

Well, of course, he is absolutely right. Sps does renice itself not
just to go faster but also in an attempt to look at separate kernel data
structures before they are changed too much or become too inconsistent
with one another.  In practise, however, it doesn't seem to affect the
response time of sps too much whether it runs at nice -20 or nice 0.

One solution, suggested by Jeffrey Mogul, is to renice sps only for root.
This also means that sps need not be a setuid program.
Here is the diff for main.c -

26,28c26,29
< 	/* Renice as fast as possible for root (Suggested by Gregorio!mogul) */
< 	if ( !getuid() )
< 		(void)nice( -40 ) ;
---
> # ifndef TRACE
> 	(void)nice( -40 ) ;
> 	(void)setuid( getuid() ) ;
> # endif

Personally, I don't think it matters much either way.

(Robert Ward, Hasler AG, Belpstrasse 23, CH-3000 Bern 14, Switzerland).



More information about the Comp.sources.bugs mailing list