Date: Sun, 25 Mar 2001 16:43:21 -0600 (CST) From: Ryan Thompson <ryan@sasknow.com> To: Paul Herman <pherman@frenchfries.net> Cc: j mckitrick <jcm@FreeBSD-uk.eu.org>, freebsd-questions@FreeBSD.ORG Subject: Re: interpreting 'load' statistics Message-ID: <Pine.BSF.4.21.0103251636100.61001-100000@ren.sasknow.com> In-Reply-To: <Pine.BSF.4.33.0103252320280.13408-100000@husten.security.at12.de>
next in thread | previous in thread | raw e-mail | index | archive | help
Paul Herman wrote to Ryan Thompson: > The others have already given good answers, but when I read... > > > Make a fork bomb. > > Run the fork bomb AS A NORMAL USER. > > As root, run uptime. > > Kill the fork bomb. > > > > ryan@stimpy$ uptime > > 1:01PM up 91 days, 10:17, 3 users, load averages: 572.68, 607.01, 388.05 > > ...I just wanted to point out that there is an interesting 'feature' > that I found when testing the same thing. The load only goes up to > 1024.00. After that, it rolls back over to 0.00. That _is_ kinda interesting. The reason behind this is found in param.h: /* * $FreeBSD: src/sys/sys/param.h,v 1.38.2.12 1999/12/17 07:48:07 jkh Exp $ */ . . . /* * Scale factor for scaled integers used to count %cpu time and load avgs. * * The number of CPU `tick's that map to a unique `%age' can be expressed * by the formula (1 / (2 ^ (FSHIFT - 11))). The maximum load average that * can be calculated (assuming 32 bits) can be closely approximated using * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15). * * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age', * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024. */ #define FSHIFT 11 /* bits to right of fixed binary point */ #define FSCALE (1<<FSHIFT) #endif /* _SYS_PARAM_H_ */ The rest can be found in the source for the vm.loadavg sysctl. I suppose if somebody wrote a patch to check for the overflow condition on shift, and made the value ceiling at 1024 (or maybe even 999.99), it might receive some consideration. Under normal circumstances, though, one generally does not see a machine run with load averages > 1K :-) Of course, you could always tune FSHIFT to meet the needs of your system, too. - Ryan > 09:22:12{{ttyp4}pherman@husten}~//> uptime > 9:24AM up 21 mins, 1 user, load averages: 1000.21, 723.32, 429.71 > 09:24:11{{ttyp4}pherman@husten}~//> uptime > 9:25AM up 23 mins, 1 user, load averages: 1023.58, 805.98, 492.73 > 09:25:50{{ttyp4}pherman@husten}~//> uptime > 9:25AM up 23 mins, 1 user, load averages: 0.74, 809.83, 495.92 > 09:25:53{{ttyp4}pherman@husten}~//> uptime > 9:26AM up 23 mins, 1 user, load averages: 160.21, 817.34, 502.26 > 09:26:00{{ttyp4}pherman@husten}~//> ps ax | wc > 1075 6450 41030 > > I found this out on a machine with only 64MB RAM which ain't an easy > trick, but I could still get work done on the machine and kill the > processes without any major problems, and I didn't have to reboot. > Gotta love FreeBSD. > > -Paul. > > -- Ryan Thompson <ryan@sasknow.com> Network Administrator, Accounts SaskNow Technologies - http://www.sasknow.com #106-380 3120 8th St E - Saskatoon, SK - S7H 0W2 Tel: 306-664-3600 Fax: 306-664-1161 Saskatoon Toll-Free: 877-727-5669 (877-SASKNOW) North America To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0103251636100.61001-100000>