Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!spool.mu.edu!cs.umn.edu!uc!shamash!timbuk!pittpa!moody From: Ray.Moody@Cray.Com Newsgroups: comp.unix.wizards Subject: Re: ccpu Message-ID: <115829.28580@timbuk.cray.com> Date: 18 Apr 91 17:37:14 GMT Lines: 31 Originator: moody@pittpa >Can anybody tell me more about the kernel variable ccpu? >Where does it stand for? >Is its value a constant or not? >What is the use of it? Ccpu is used compute a processes percent CPU utilization. It is a constant traditionally set to exp(-1/20). It is unusual in that it is one of the very few floating point numbers in the kernel. Some machines that don't have floating point hardware and don't want to load floating point emulation routines into the kernel will treat ccpu as a fixed point number. Check out FSCALE in . Machines that do this are subject to significant truncation (not roundoff) errors. Ccpu is used to "decay" the percent CPU utilization of a process. A process that is listed as having 100% of the CPU will be decayed to 36.78% CPU if it is idle for 20 seconds. The 20 comes from the 1/20 part and the 36.78% comes from 1/e where e is the base of natural logarithms. I imagine that natural logarithms were used because they are preferred by mathematicians for decay related math (such as radioactivity). I believe that the constant "20" is more or less arbitrary. Somewhere I remember seeing this constant "20" in an ancient scheduler to represent the attention span of a human. (It is interesting to note that "ps" reports processes that have been inactive for more than 20 seconds as "Idle" but processes that have been inactive for less than 20 seconds as "Sleeping".) Ray