Terry : Sysfs and procfs

Sysfs

Sysfs is a virtual file system provided by Linux 2.6. Sysfs exports information about devices and drivers from the kernel device model to userspace, and is also used for configuration. It is similar to the sysctl mechanism found in BSD systems, but implemented as a file system instead of a separate mechanism.

Example:

Disable 1 of the core:

echo 0 > /sys/devices/system/cpu/cpu1/online

Procfs

On many Unix-like computer systems, procfs, short for process file 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 and this is its location in the Filesystem Hierarchy Standard. Because /proc is dynamically generated rather than stored, it consumes no storage space and only a limited amount of memory.

The following operating environments support procfs:

  • Solaris
  • IRIX
  • Tru64 UNIX
  • BSD
  • Linux (which extends it to non-process-related data)
  • IBM AIX (which bases its implementation on Linux to improve compatibility)
  • QNX
  • Plan 9 from Bell Labs (where it originated)

Example

Check the open file descriptors

cat /proc/sys/fs/file-nr

Reference:

http://en.wikipedia.org/wiki/Sysfs

http://en.wikipedia.org/wiki/Procfs