Procfs

From Wikipedia, the free encyclopedia

The correct title of this article is procfs. The initial letter is shown capitalized due to technical restrictions.

On Unix-like computer systems, procfs, short for process file system, is a pseudo-file system 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.

procfs is supported under:

Contents

[edit] History

[edit] UNIX 8th Edition

The UNIX 8th Edition version of /proc was implemented by Tom J. Killian, who presented a paper titled Processes as Files at USENIX in June 1984. It was designed in order to replace the ptrace system call used for process tracing.

[edit] SVR4

Roger Faulkner and Ron 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 of ps, but the files could only be accessed with functions read(), write(), and ioctl().

[edit] 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.

[edit] 4.4BSD

4.4BSD's implementation of /proc was cloned from Plan 9.

[edit] Solaris

Solaris 2.6's /proc (finished in 1996) was also a clone from Plan 9.


[edit] Linux

The /proc implementation of Linux is also a clone of Plan 9. Under Linux, /proc provides information on any running process at /proc/PID, but in addition to that it also includes:

  • A symbolic link to the current (traversing) process at /proc/self
  • Information on hardware, the kernel, and module configurations
  • Access to dynamically-configurable kernel options under /proc/sys
  • Information about the system as a whole, such as /proc/meminfo, which provides memory statistics.

The basic utilities that use /proc under Linux are in the procps package, and they require that /proc is mounted in order to function.

The procfs plays an important role in moving functionality from kernel space to user space. For example the GNU version of ps operates entirely in user mode, using the procfs to obtain its data.

In Linux kernel 2.6, much of the non-process related files under /proc were moved to a separate pseudo-file system called sysfs (mounted under /sys).

[edit] /meminfo

/proc/meminfo is a pseudo-file in the proc filesystem of recent versions of the Linux kernel. It is accessed to provide information about the current state of the system's computer memory, including information about virtual memory and the cache. 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 several system monitor utilities.

[edit] References

In other languages