“The /proc filesystem is a virtual filesystem that permits a novel approach for communication between the Linux kernel and user space. In the /proc filesystem, virtual files can be read from or written to as a means of communicating with entities in the kernel, but unlike regular files, the content of these virtual files is dynamically created. This article introduces you to the /proc virtual filesystem and demonstrates its use.”
sysctl vs. proc!
Go go go!
One of the very first things I do to 90% of the linux servers I work on is turn down the “swappiness” level via sysctl so that the system is less likely to swap. The kernel defaults the number to 60 and I set it to 10. It seems to improve performance in our Weblogic and Oracle servers if they have >8GB of ram.
To change it on the fly:
sysctl -w vm.swappiness=10
To change it permanently:
echo ‘vm.swappiness=10′ >> /etc/sysctl.conf && sysctl -p
Some people don’t realize that /proc and sysctl modify the same values. sysctl -w vm.swappiness=10 and echo ’10’ > /proc/sys/vm/swappiness do the *exact* same thing.
“The /proc filesystem was originally developed to provide information on the processes in a system. But given the filesystem’s usefulness, many elements of the kernel use it both to report information and to enable dynamic runtime configuration.”
All this “added” functionality of /proc has grown so out of hand, that kernel developers are pushing (and imho rightly so) for a lot of those non-process related entries to be moved out of proc. Current alternatives are sysfs (/sys) for information about hardware, and a debugfs for stuff only developers need. I believe a configfs was debated for other configuration entries, but the Netlink interface is also considered for that.
The article does indeed give a nice introduction into /proc, and how to add an entry to it. But before adding another $knob or $lever, please think about whether it really belongs in /proc, or somewhere else. /proc is slowly being restored to its original function: showing info about running processes.