- Procfs
On many
Unix -like computer systems, procfs, short for processfile system , consists of a pseudo file system (a file system dynamically generated at boot) used to access process information from the kernel. The file system is often mounted at the/proc
directory. Because /proc is not a real file system, it consumes no storage space and only a limited amount of memory.The following operating environments support procfs:
* Solaris
* BSD
*Linux (which extends it to non-process-related data)
*IBM AIX (operating system) (which bases its implementation on Linux to improve compatibility)
*QNX
*Plan 9 from Bell Labs (where it originated)History
UNIX 8th Edition
Tom J. Killian implemented the UNIX 8th Edition version of/proc
: he presented a paper titled "Processes as Files" atUSENIX in June 1984. The design of procfs aimed to replace the "ptrace " system call used for process tracing.SVR4
Roger Faulkner andRon Gomes ported V8/proc
to SVR4, and published a paper called "The Process File System and Process Model in UNIX System V" at USENIX in January 1991. This kind of procfs supported the creation ofps
, but the files could only be accessed with functionsread()
,write()
, and
.ioctl ()Plan 9
Plan 9 implemented a process file system, but went further than V8. V8's process file system required operations applied to a single file for all functions related to a process. Plan 9 used separate files to provide those functions, and it made /proc a real part of the file system.
4.4BSD
4.4BSD cloned its implementation of/proc
from Plan 9. Note that in FreeBSD procfs is being gradually phased out.Solaris
Solaris 2.6's
/proc
(finished in 1996) also cloned Plan 9.Linux
The
/proc
implementation ofLinux also clones that of Plan 9. Under Linux,/proc
includes:* a directory for each running process (including kernel processes) at
/proc/"PID"
, containing information about that process. Notably:
**/proc/"PID"/cmdline
, which contains the command which originally started the process.
**/proc/"PID"/cwd
, asymlink to the current working directory of the process.
**/proc/"PID"/exe
, a symlink to the originalexecutable file , if it still exists (a process may continue running after its original executable has been deleted or replaced).
**/proc/"PID"/root
, a symlink to the root path as seen by the process. For most processes this will be a link to / unless the process is running in achroot jail .
**/proc/"PID"/status
, a file containing basic information about a process including its run state and memory usage.
**/proc/"PID"/task
, a directory containinghard links to any tasks that have been started by this (i.e.: the parent) process.
**/proc/"PID"/maps
, the memory map showing which addresses currently visible to that process are mapped to which regions in RAM or to files.
* depending on the mode of power management (if at all), either directory,/proc/acpi
or/proc/apm
, which predatesysfs and contain various bits of information about the state of power management.
*/proc/bus
, containing directories representing various buses on the computer, such as input/PCI/USB. This has been largely superseded bysysfs under /sys/bus which is far more informative.
*/proc/cmdline
, giving the boot options passed to the kernel
*/proc/cpuinfo
, containing information about theCPU , such as its vendor (and CPU family, model and model names which should allow users to identify the CPU) and its speed (CPU clockspeed), cache size, number of siblings, cores, and CPU flags. It contains a value called "bogomips ", frequently misunderstood as measure CPU-speed like a benchmark, while it doesn't actually measure any sensible (for end-users) value at all. It occurs as a side-effect of kernel timer calibration and yields highly varying values depending on CPU type, even at equal clock speeds.
*/proc/crypto
, a list of available cryptographic modules
*/proc/devices
, a list of character and block devices sorted by device ID but giving the major part of the/dev
name too
*/proc/diskstats
, giving some information (including device numbers) for each of the logical disk devices
*/proc/filesystems
, a list of the file systems supported by the kernel at the time of listing
*/proc/interrupts
,/proc/iomem
,/proc/ioports
and the directory/proc/irq
, giving some self-explanatory details about the devices (physical or logical) using the various system resources
*/proc/meminfo
, containing a summary of how the kernel is managing its memory.
*/proc/modules
, one of the most important files in/proc
, containing a list of the kernel modules currently loaded . It gives some indication ( not always entirely correct) of dependencies.
*/proc/mounts
, a symlink to self/mounts which contains a list of the currently mounted devices and their mount points (and which file system is in use and what mount options are in use).
*/proc/net
, a directory containing a lot of really useful information about the network stack, in particular ip_conntrack which lists existing network connections (particularly useful for tracking routing wheniptables FORWARD is used to redirect network connections).
*/proc/partitions
, a list of the device-numbers, their size and/dev
names which the kernel has identified as existing partitions (for example if /dev/sda contains a partition table, then /dev/sda1 and others will appear as available partitions). Note that if a partition isn't listed in this file, then a patched version of losetup is around which can essentially mount the partition and connect /dev/loop [n] devices to the various partitions (though it is not certain if these will then appear in/proc/partitions
).
*/proc/scsi
, giving information about any devices connected via aSCSI orRAID controller
* a symbolic link to the current (traversing) process at/proc/self
(i.e./proc/"PID"/
where PID is that of the current process).
*/proc/slabinfo
, listing statistics on the caches for frequently-used objects in the Linux kernel
*/proc/swaps
, a list of the active swap partitions, their various sizes and priorities
* Access to dynamically-configurable kernel options under/proc/sys
. Under/proc/sys
appear directories representing the areas of kernel, containing readable and writable virtual files.
For example, a commonly referenced virtual file is/proc/sys/net/ipv4/ip_forward
, because it is necessary for routing firewalls or tunnels. The file contains either a '1' or a '0': if it is 1 then the IPv4 stack will forward packets not meant for the local host, if it is 0 then it will not.
*/proc/sysvipc
, containing memory sharing and IPC information.
*/proc/tty
, containing information about the current terminals;/proc/tty/driver
looks to be a list of the different types of tty available each of which is a list of those of each type
*/proc/uptime
, the length of time the kernel has been running since boot and spent in idle mode (both in seconds)
*/proc/version
, containing the Linux kernel version, distribution number, gcc version number (used to build the kernel) and any other pertinent information relating to the version of the kernel currently running
*/proc/version_signature
(specific to the Ubuntu distribution), giving only the distribution kernel version number and which type of Ubuntu kernel it is (for example.: generic)
* other files depending on various hardware, module configurations, and changes to the kernel.The basic utilities that use /proc under Linux come in the
procps (/proc processes) package, and only function in conjunction with a mounted/proc
.The procfs plays an important role in moving functionality from
kernel space touser space . For example theGNU version ofps
operates entirely in user mode, using the procfs to obtain its data.The developers of the Linux 2.6 kernel moved many of the non-process-related files under
/proc
to a separate pseudo-file system called "sysfs " (mounted under/sys
).Cobalt
Note that Cobalt boxes also include a few additions to
/proc
:
*/proc/cobalt
, a directory containing cobalt-specific things like the serial number and the systype (system type).
*/proc/lcd
, a read/writable file containing the contents of the front-panel LCD screen. Echoing text to this file changes that on the front panel./proc/cpuinfo
In Linux, the
pseudo-file /proc/cpuinfo
contains information about all the CPUs in the system. It features a number of lines:*
processor
, a number used by the system to identify each logical CPU
*vendor_id
, a string used to identify the CPU manufacturer (i.e.: AuthenticAMD or GenuineIntel)
*cpu_family
, a number giving the major version of the CPU, as follows:
**Intel - Intel states thatcpu_family
indicates only the manufacturing process, not the CPU version [ [http://softwarecommunity.intel.com/isn/community/en-us/forums/thread/980608.aspx Intel forum post on cpu_family] ] ; however, it has made a [http://developer.intel.com/design/processor/applnots/241618.htm PDF with a complete list of responses to the CPUID command on Intel CPUs] available. A rough summation follows:Operating systems other than Linux do not implement
/proc/cpuinfo
; they make the same information readily available by other means, such as thepsrinfo(1M)
command under Solaris orcpuid(1)
under FreeBSD./proc/meminfo
/proc/meminfo
appears as apseudo-file in the proc filesystem of recent versions of theLinux kernel . It is accessed to provide information about the current state of the system'scomputer memory , including information aboutvirtual memory and thecache . It is the primary method for user-level programs to obtain information about the system's memory state, and is used in the implementation of severalsystem monitor utilities.External links
* [http://osxbook.com/book/bonus/chapter11/procfs/ A MacFUSE-Based Process File System for Mac OS X]
* [http://www.ibm.com/developerworks/library/l-proc.html Access the Linux kernel using the Procfs] An IBM developerWorks article by M. Tim Jones
* [http://tldp.org/LDP/Linux-Filesystem-Hierarchy/html/proc.html Linux-Filesystem-Hierarchy] Linux Documentation ProjectReferences
* [http://www.redhat.com/advice/tips/meminfo.html Red Hat, Inc. "Tips & Tricks Featured Article: /proc/meminfo Explained", March 2003.]
Wikimedia Foundation. 2010.