Date: Mon, 22 Mar 1999 21:53:14 -0500 (EST) From: zhihuizhang <bf20761@binghamton.edu> To: freebsd-hackers@FreeBSD.ORG Subject: understanding of scaled load average calculation Message-ID: <Pine.SOL.L3.93.990322213107.10307A-100000@bingsun2>
next in thread | raw e-mail | index | archive | help
I am trying to understand the calculation of digital decay contants used by process scheduler and ps command (see file kern_synch.c). I have read the web page "fixed-point arithmetic" at http://www.shadow.net/~yates/fp.htm. But I still could not figure out how FSHIFT and CCPU_SHIFT are chosen. The following comment in the source code confuses me: "The number of CPU ticks that map to a unique %age can be expressed by the formula (1/(2 ^ (FSHIFT-11)))." Where does this formula come from? "To estimate CCPU_SHIFT for exp(-1/20), the following formula was used: 1 - exp(-1/20) ~= 0.0487 ~= 0.0488 == 1 (fixed pt, *11* bits)." What does this mean? I do know that 11 fractional digit gives a resolution of 2 ^ (-11) = 0.00048828. The three digits 488 are the same. I did make a little progress in trying to understand this comment: If FSHIFT is 11, the maximum load average is about 1024. This is because cexp[i]*avg->ldavg[i] in routine loadav() (see file vm_meter.c) will overflow if the unscaled load average > 1024. I hope someone will help me out. Thanks a lot. -------------------------------------------------- | Zhihui Zhang, http://cs.binghamton.edu/~zzhang | | Dept. of Computer Science, SUNY at Binghamton | -------------------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SOL.L3.93.990322213107.10307A-100000>