Hasso Tepper <[EMAIL PROTECTED]> wrote: > I noticed that even if I nice my compile jobs to 20, my desktop still > lags significantly. It might not be related, but while hunting potential > causes I noticed strange issue with load stats: > > ~:# while true; do echo "foo" > /dev/null; done > > 33.1%Sys 1.2%Intr 65.7%User 0.0%Nice 0.0%Idl > > ~:# while true; do nice -n 20 echo "foo" > /dev/null; done > > 33.3%Sys 44.2%Intr 21.9%User 0.6%Nice 0.0%Idl > > Just wrong stats? I didn't notice any obvious error at first glance in > the kern/kern_clock.c, so anyone has ideas what's going on?
Just a small side note (not related to the actual problem). Your first example consists entirely of shell-builtins, so doesn't call any external programs. Your second example uses nice, which is an external tool (csh has a nice builtin, but sh doesn't), so you get the whole fork+exec overhead. Furthermore, the nice command will call the /bin/echo external command (it has no way to use the shell's builtin echo), so you get yet another exec system call. To make things comparable, you should enclose the whole loop into the nice command. It's best to use nice in both cases (first with nice value 0, then with nice value 20), so you make sure that there are no other hidden differences in the call. $ nice -n 0 sh -c 'while :; do echo foo >/dev/null; done' $ nice -n 20 sh -c 'while :; do echo foo >/dev/null; done' By the way, the nice value only affects scheduling of processes, but has no effect on I/O. So if your compile jobs put a heavy load on your disks, nicing it will not help much, I'm afraid. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way.
