stopping deschall from eating any cpu

Eating Before Swimming (mathboy@sizone.org)
Fri, 23 May 1997 17:00:06 -0400 (EDT)


then Collin Ong's all..

> % nice -19 deschall gateway
>
> I get the following using top:
>
> PID USER PRI NICE SIZE RES STAT TIME CPU% COMMAND
> 23590 collin 126 19 136K 196K run 23:44 99.0% dc2
>
> But if I run another computationally intensive process, deschall drops to
> about 30% and the other process gets 70%. Since the other process is
> likely to be a silicon simulation or something important, slowing this
> down with the deschall process is not acceptable.

This is difficult to figure out.

Run the program by itself. Does it run at 100% CPU by itself? Even if it
does, it could be waiting for disk. I am not sure how such things (if
they are disk intensive and definitely if they're swapping) will log
how much CPU usage - when things are swapping like mad on my smaller
linux box with 8 megs, the load shoots up - but the CPU is probably
very unloaded, waiting for all that disk.

You'd have to do some intense investigation with the help of vmstat in
this case and other tools to figure out what your program wants to be
using in the system... if its ONLY CPU in a small memory space or otherwise.

I can play Linux SQuake with Deschall (linux client obv.) at -19. At -10
I notice it affecting my play. I have estimated that any effects that
last longer than 0.06-0.08 seconds long in quake are noticeable. At -19
it is not noticeable (but then linux deschall falls to 70kk/s from 675kk/s).

> Am I doing something wrong or is there no way to get deschall to drop to
> single digit CPU % when something else runs. Most normal processes run
> at NICE level 0.

Depends on whats running. Perhaps try coding some simple C which just
loops and increments a long integer or something, that should use up
alot of CPU and no memory, and see what % CPU it gets with and without
deschall at various nice levels.

> Can anything be done to further lower deschall's CPU usage when something
> else is running? If so, I can get a bunch of workstations on the task
> this weekend.

You can always kill -STOP it when you really need the CPU and restart
it when you dont.

Even a simple kludge shell script may work ok for you:

------------------------------------------------------------------------------
#!/bin/sh

if ! [ "$1" ]; then
echo "usage: $0 (cpu_intense_process's_name) (deschall_proc_id)"
exit
fi
myprocname=$1
deschallpid=$2

# replace ps -uxw with your version of ps which shows you your procs
# this may have trouble with swapped processes which change their name
while true; do
if (ps -uxw | grep -v grep| grep -q $1); then
kill -STOP $deschallpid
usingCPU=1
while [ "$usingCPU" ]; do
if ! (ps -uxw | grep -v grep | grep -q $1);
kill -CONT $deschallpid
usingCPU=0
else
sleep 60
fi
done
fi
sleep 10
done

------------------------------------------------------------------------------

this shoudl check every 10 seconds if you've started your process and
shut deschall down in an average of 5 seconds thereof, and then
on average will start deschall backup 30 seconds after yer done. change
the numbers to taste. you can nice this script as well to make sure
it takes minimal CPU itself (sleep is pretty efficient which is most
of this codes lifecycle).

I have a slightly more complex set of personal scripts related to this to
do stuff like "whendone doing_someting do_this_otherthing". Specailly
when I start a nasty pipe or something in the bg and cant bring it
back to the fg and type stuff into the console STDIN which will get
executed when the shell comes back when the current job is done...

/kc

-- 
Ken Chase mathboy@sizone.org Sonic Interzone $free$ email/news Toronto Canada
------------------------------------------------------------------------------
Join the DES Challenge! Wake up the US Govt!   www.frii.com/~rcv/deschall.htm

NB:Only 16000 P200-months CPU req'd to recover 56-bit IBM alliance keys! ** U.S. EXPORT LAWS MAY NOT APPLY TO YOUR COUNTRY: DEVELOP YOUR NATIONS' OWN CRYPTO-EXPORT INDUSTRY! USE 2048bit KEYS FREELY! FLAUNT YOUR SOVEREIGNTY! **