/proc
By Stephen Tweedie, Digital Equipment Corporation
Summary by Bruce Alan Wynn
We've all known that it was there for quite some time, but how many
of us ever even looked at the /proc filesystem?
In this presentation, Stephen described the wealth of
process-specific information that can be found in the
/proc filesystem. He explained why traditional UNIX
tools may report strange statistics on objects in this
filesystem-as Stephen says, "stat() tells lies."
The reason for these seeming inconsistencies is the nature of the
/proc filesystem and its files. Although you can read
the directory for the names of the files, the actual file
"contents" are generated dynamically when you open the file for
reading. Hence, subsequent commands are actually accessing
different "files."
The Linux /proc filesystem is currently read-only.
Therefore, system administrators can only use it to examine process
statistics, but not change them. Tools that access these files
display process information in textual form for ease of human
consumption.
But what if you want to change these things and tune your system?
Stephen also spoke at length about using the sysctl()
system call. Using sysctl() , some process information
is writable, allowing tuning. Because sysctl() does
not need to convert the process information into human-readable
form (it is stored in well defined structures), access to the
process information is faster than using the /proc
filesystem directly.
In conclusion, Stephen pointed out that Linux 2.1 is continuing to
develop the sysctl() interface by migrating the
ability to configure sysctl() at compile time.
Originally published in ;login: Vol. 22, No.2, April 1997.
|