Slopsuckers

John B. Milton jbm at uncle.uucp
Sat Mar 30 14:29:23 AEST 1991


In article <6274 at amc-gw.amc.com> jwbirdsa at polaris.amc.com () writes:
>
>   My 3B1 spends 95% of its time with the yellow "no process" light
>showing. Does anybody have a raytracer or other interesting noninteractive
>program which could be renice'd heavily and keep the machine gainfully
>employed? :)
You could renice a CPU intensive program down, but it will still have a
significant impact on other higher priority processes. This is because of
the granularity of the schedualer. Once a low priority process starts running,
it will continue to run until the next time the schedualer picks another
process to run. The place in the kernel where it waits when idle is a function
called "idle". It is called by the schedualer, "swtch". I have found the JSR
instruction in swtch in 3.51m and written a loadable device driver which
patches it to go to a replacement idle function in the driver. This may be of
limited use, because the idle function executes in kernel space, but it is a
hook for those of you who are interested. Another problem with putting
useful code here is the fact that idle() must stop doing whatever it's doing
when a global flag is cleared (by interrupt routines). The VIDMEM stuff in
the example idle function is the "useful" part. The other stuff (clock, spl)
has to stay there.

>   Also, somebody recently asked how to get HDB to dial tone instead of
>pulse. Was there an answer?
If you are using an extern HAYES type modem, then change ATDP to ATDT on the
appropriate line in the Dialers file (System->Devices->Dialers). If you are
using the OBM, edit the appropriate file in /etc: .lineone or .linetwo, the
TT= is for TouchTone (TM).

John
---
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  idl.c inst
# Wrapped by jbm at uncle on Fri Mar 29 23:24:46 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'idl.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'idl.c'\"
else
echo shar: Extracting \"'idl.c'\" \(2071 characters\)
sed "s/^X//" >'idl.c' <<'END_OF_FILE'
X/* vi:set ts=2 sw=2: */
X
X#include <sys/hardware.h> /* for led_on/off */
X#include <sys/iohw.h> /* for VIDMEM */
X
X#if 0
X#define VILEN 16
X#define VIDLE1 (VIDMEM+309*45+28)
X#define VIDLE2 (VIDMEM+310*45+28)
X#else
X#define VILEN 45
X#define VIDLE1 (VIDMEM+346*45+0)
X#define VIDLE2 (VIDMEM+347*45+0)
X#endif
X
Xextern short clkrun;
Xextern int idleflag;
Xextern int swtch();
Xextern long scrticks;
X
Xstatic int myidle(n)
Xint n;
X{
X	register char off=0,offn=0,c1,c2;
X	int x;
X	unsigned short value[VILEN];
X
X	idleflag=1;
X	x=spl0();
X	value[0]=0x8000;
X	while (idleflag && n) {
X		led_on(LED2); /* tell the world we're idle */
X		if (n>0)
X			n--;
X		spl0();
X		if (clkrun)
X			clockspecial();
X		if (scrticks>=0) {
X			if (value[off]&1) {
X				offn=(off+1)%VILEN;
X				value[offn]=(value[offn]>>1)|0x8000;
X				*(VIDLE1+offn)=*(VIDLE2+offn)=value[offn];
X				c2=offn;
X			}
X			value[off]>>=1;
X			c1=off;
X			if (!value[off]) {
X				*(VIDLE1+off)=*(VIDLE2+off)=0;
X				off=offn;
X			} else
X				*(VIDLE1+off)=*(VIDLE2+off)=value[off];
X		}
X	}
X	if (scrticks>=0)
X		*(VIDLE1+c1)=*(VIDLE2+c1)=*(VIDLE1+c2)=*(VIDLE2+c2)=0;
X	idleflag=0;
X	led_off(LED2);
X	splx(x);
X}
X
Xstatic int orig;
X
Xidlinit()
X{
X	char *oldidle;
X
X	oldidle=(char *)swtch;
X	oldidle+=0x7c+2; /* point to the long address part of the jsr */
X	orig=*(int *)oldidle;
X	*(int *)oldidle=(int)myidle;
X	return;
X}
X
Xidlrelease()
X{
X	char *oldidle;
X
X	oldidle=(char *)swtch;
X	oldidle+=0x7c+2; /* point to the long address part of the jsr */
X	*(int *)oldidle=orig;
X	return;
X}
X
X#if 0
Xswtch+70:		mov.b	&7f,curpri
Xswtch+78:		moveq.l	&-1,%d0
Xswtch+7a:		mov.l	%d0,(%sp)
Xswtch+7c:		jsr	idle
Xswtch+82:		or.w	&700,sr
Xswtch+86:		and.w	&-101,sr
X
X                                TS32:
X000498: 13fc 007f 0000 0000             mov.b   &127,curpri
X0004a0: 70ff                            mov.l   &-1,%d0
X0004a2: 2e80                            mov.l   %d0,(%sp)
X0004a4: 4eb9 0000 0000                  jsr     idle
X
X                                TS30:
X0004aa: 007c 0700                       or.w    &0x700,%sr
X0004ae: 027c feff                       and.w   &0xfffffeff,%sr
X#endif
END_OF_FILE
if test 2071 -ne `wc -c <'idl.c'`; then
    echo shar: \"'idl.c'\" unpacked with wrong size!
fi
# end of 'idl.c'
fi
if test -f 'inst' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'inst'\"
else
echo shar: Extracting \"'inst'\" \(361 characters\)
sed "s/^X//" >'inst' <<'END_OF_FILE'
X:
X# vi:set ts=2 sw=2:
Xif cc -Oc idl.c; then
X	mv idl.o /etc/lddrv
X	cd /etc/lddrv
X	if ../masterupd -c idl >/dev/null; then
X		./lddrv -dv idl
X	else
X		../masterupd -a char init release idl
X	fi
X	sync; sync; sync
X	./lddrv -av idl
X	# uncomment if you want "idl" to come up when you boot
X	# if grep '^idl$' drivers >/dev/null; then :; else echo "idl" >> drivers; fi
Xfi
END_OF_FILE
if test 361 -ne `wc -c <'inst'`; then
    echo shar: \"'inst'\" unpacked with wrong size!
fi
chmod +x 'inst'
# end of 'inst'
fi
echo shar: End of shell archive.
exit 0
-- 
John Bly Milton IV, jbm at uncle.UUCP, n8emr!uncle!jbm at osu-cis.cis.ohio-state.edu
(614) h:252-8544, w:785-1110; N8KSN, AMPR: 44.70.0.52; Don't FLAME, inform!



More information about the Comp.sys.3b1 mailing list