In Unix-like OSes, the proc is a unique filesystem that illustrates details about processes and details of other systems in a hierarchical file-like structure.
It is giving a more standardized and convenient mechanism to dynamically access process data held within the kernel as compared to the direct access to the kernel memory or the traditional tracing mechanisms or direct access.
It is typically mapped to the mount point referred to as /proc on boot time. A proc file system implements as an interface data structure within the kernel. It could be used for obtaining information about a system and for changing several kernel parameters on run time.
Various Unix-like OSes support a proc filesystem like Plan 9 from Bell Labs, IBM AIX, QNX, Linux, BSD, Tru64 Unix, IRIX, and Solaris. OpenBSD was published in May 2015 dropped its support in the 5.7 version.
The Linux kernel develops it to the non-process-related data.
A proc filesystem gives a communication method between user space and kernel space. For example, the GNU version of a process reposting utility ps applies a proc filesystem for obtaining the data without applying a specialized call.
History of proc filesystem
UNIX 8th Edition
Tom J. Killian achieved the proc UNIX 8th Edition (V8) version. In June 1984, he illustrated at USENIX paper entitled "Processes as Files". The proc filesystem design focused on replacing a system call, i.e., ptrace used to process trace.
Ron Gomes and Roger Faulker ported V8 /proc version to SVR4 and released a paper at USENIX which is known as "The Process File System and Process Model In Unix System V" in January 1991. This type of proc filesystems supported the ps creation, but the files can only be used with some functions such as ioctl(), read(), and write().
Between 1995 year and 1996 year, Roger Faulker established the interface of the procfs-2 for the 2.6 version of Solaris that provides an organized /proc filesystem with many sub-directories.
4.4BSD copied it's /proc implementation through Plan 9. Gradually, the procfs becoming phased out within FreeBSD as of February 2011. It was deleted in the 5.7 version from OpenBSD which was published in May 2015 as it "always suffered from many race conditions and now it is unused".
Plan 9 carried out a process file system. Although, it went further as compared to V8. The process file system of V8 carried out one file per process. This edition made /proc file which an original file system's part and it also made a hierarchy of isolated files for providing those functions.
In 1992, Linux initially added a /proc in v0.97.3, and first started developing it to the non-process related data in December 1992 in v0.98.6.
The implementation of Linux contains a directory for all the running processes as of 2020 including processes of the kernel, in directories called /proc/PID, in which PID is a number of the process.
All directories include details about a single process. Some of these directories are explained below:
Non-process-related system information of /proc
Also, the /proc file contains non-process-related information about the system. However, much of the information moved to an isolated sysfs, pseudo-file system, mounted under /sys in the 2.6 version of the kernel:
Either /proc/apm or /proc/acpi directory is relying on the power management mode which anticipates sysfs and includes several information bits about the power management state.
This directory includes the "bogomips" value that is rapidly misconstrued as the CPU speed measure such as a benchmark. However, it doesn't measure a sensible value for end-users at all. It appears as a kernel timer calibration side effect and highly yields changing values relying on the type of CPU at the same clock speed.
A CPU package indicates a physical CPU that could have more than one core (quad-core for four, dual-core for two, one core for one). It permits a difference between dual-core and hyper-threading that is the one hyper-threading per CPU package could be measured by CPU or siblings core, if both the values for any CPU package are equal, hyper-threading will not be supported.
For example, a CPU package along with cpu cores=2 and siblings=2 is a dual-core CPU but doesn't support the hyper-threading process.
In Solaris, the /proc file was present from the starting. The 2.6 version of Solaris was announced /proc2 by Roger Faulker in 1996.
Various projects and companies added many additional functions to the /proc filesystem for their system. For example, the file /proc/lcd may contain the front-panel LCD screen contents. The text mentioned in this file will be shown on the screen.