I am only interested in answers related to Mac OS X as I would assume the answer would be different based on OS.
For example, Apple mentions the kernel variable avenrun in this document. I know that there are many more and I believe a complete list can be generated by doing:
nm -j /mach_kernel
However, just having a list of names doesn't tell me anything about the structure of the variable or how they might be used.
What I was wondering is how one might go about learning what kernel variables are available, how they might be used, and how to use them.
The best idea would be to look at the kernel source, which is available from Apple's download page. which you can get at http://www.opensource.apple.com/source/xnu/
Unfortunately just knowing what the kernel variables are doesn't really help you much; it really depends on what you are trying to achieve. If you're doing it purely for learning purposes about the kernel, then the source is a much better place to learn about. However, what the variables do are not as important as finding out the solution to a particular problem, which in this case isn't stated.
If you run 'uname -a' you'll get a link to the kernel version in question:
$ uname -a
Darwin my.host.name 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64
So this is based on 1504.15.3, which is located at: http://www.opensource.apple.com/source/xnu/xnu-1504.15.3/
Most of the useful information is accesible via 'sysctl -a kern.', but this is implemented in the bsd/kern/kern_sysctl file, which is located at:
http://www.opensource.apple.com/source/xnu/xnu-1504.15.3/bsd/kern/kern_sysctl.c
Unfortunately that doesn't tell us about this avenrun variable specifically. However, if you look in host.c:
http://www.opensource.apple.com/source/xnu/xnu-1504.15.3/osfmk/kern/host.c
it shows up as a variable which is being used to calculate average host load. So you might be able to use this to determine what the load of the system is at any point.
However, if your question was 'How do I find the load of the system?' then I'd run 'sysctl -a | grep load' and come up with 'vm.loadavg', then look for that in the sysctl at http://www.opensource.apple.com/source/xnu/xnu-1504.15.3/bsd/sys/sysctl.h to see how to read it.