bruno@saturnus.cs.kuleuven.ac.be (Bruno Vandenborre) (04/15/91)
Hi, Can anybody tell me more about the kernelvariable ccpu? Where does it stand for? Is its value a constant or not? What is the use of it? Thanks, Bruno Vandenborre | domain : bruno@kuleuven.ac.be | bitnet : bruno@blekul60.bitnet | uucp : bruno@kulcs.uucp Katholieke Universiteit Leuven | ...!mcsun!ub4b!kulcs!bruno Departement of Computer Science | phone : ++32(0)16-201015 x3642 Celestijnenlaan 200A | fax : ++32(0)16-205308 B-3001 Leuven(Heverlee), Belgium | telex : 23674 kuleuven b
Ray.Moody@Cray.Com (04/19/91)
>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 <sys/param.h>. 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
xtdn@levels.sait.edu.au (04/19/91)
Ray.Moody@Cray.Com writes: > 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. What about the comp_t fields in struct acct? They, while not floats, are apparently floating point fields. Or did you mean that ccpu is one of the few floating point constants in the kernel? David Newall, who no longer works Phone: +61 8 344 2008 for SA Institute of Technology E-mail: xtdn@lux.sait.edu.au "Life is uncertain: Eat dessert first"
trs@gibbs.physics.purdue.edu (Thomas R. Statnick) (04/21/91)
In article <16226.280f85ed@levels.sait.edu.au> xtdn@levels.sait.edu.au writes: >Ray.Moody@Cray.Com writes: >> 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. > >Or did you mean that ccpu is one of the few floating point constants in >the kernel? If you read the last sentence of what Ray said, that is *exactly* what he *is* saying. Ccpu is unusual in that it *is* one of the very few floating point numbers kept in the kernel (to paraphrase). trs
xtdn@levels.sait.edu.au (04/22/91)
trs@gibbs.physics.purdue.edu (Thomas R. Statnick) writes: > In article <16226.280f85ed@levels.sait.edu.au> xtdn@levels.sait.edu.au writes: >>Ray.Moody@Cray.Com writes: >>> It is unusual in that it is one of the very few floating point numbers in >>> the kernel. >> >>Or did you mean that ccpu is one of the few floating point constants in >>the kernel? > > If you read the last sentence of what Ray said, that is *exactly* what > he *is* saying. Oops. Sorry all, I misinterpreted the word "number" as including variables (and perhaps functions, too). My mistake. David Newall, 16:32:56.04, Tuesday, 1991 Phone: +61 8 344 2008 "Life is uncertain: Eat dessert first" E-mail: xtdn@lux.sait.edu.au