load average on Xenix

Amy Snader abs at sco.COM
Thu Jun 22 16:40:03 AEST 1989


	I was playing around with this in 2.3.1, and it appears that you have
	something like:
	
		short avenrun[3];
	
	in the kernel, and the load average values are these values divided
	by 256.0.  I came upon 256 emperically ... is there any particular
	reason or precedent for this magic cookie?  It isn't documented in
	any <sys/*.h> file that I could find.
	-- 
	Chip Rosenthal / chip at vector.Dallas.TX.US / 
	Dallas Semiconductor / 214-450-5337

The three numbers in avenrun are the 1, 5, and 15 minute load
averages.  The load average figures are updated every 5 seconds. 
These three shorts are being used
as pseudo-floating point numbers, with 8 bits to the left of the
decimal point, 8 bits to the right.
According to comments in the code, the Berkeley kernel maintains 
a load average in genuine floating point, but when the algorithm
was ported to Xenix it was translated into integer-based
psuedo-floating point.  
Because a Xenix box may or may not contain an fpu chip,
Xenix assiduously avoids performing any floating point in the
kernel.  However, once the numbers are read by a user program
it's easy enough to translate into a "normal" floating point format.
	--Amy



More information about the Comp.unix.xenix mailing list