Home >Operation and Maintenance >Linux Operation and Maintenance >What file system is proc under linux?
In Linux, proc is a virtual file system and a control center that can change the running status of the kernel by changing some of the files; it is also a query center provided by the kernel to us, through which users can view the system. Hardware and currently running process information. The proc system only exists in memory and provides an interface for accessing system kernel data in the form of a file system. The kernel operating status can be changed by changing some of the files.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
proc is called a virtual file system, it is a control center that can change the kernel operation by changing some of the files Status, it is also a query center provided by the kernel to us. Users can use it to view system hardware and currently running process information.
The data source of many tools in Linux is the content in the proc directory. For example, the lsmod command is an alias of cat /proc/modules.
There is a special type of pseudo file system in Linux, which is used to complete various functions using operations unified with the file interface, such as ptyfs, devfs, sysfs and procfs. Procfs is one of the most widely used pseudo file systems.
As far as the term file system is concerned, the /proc directory is not a real file system, it is a virtual file system, sometimes also called a process information pseudo file system.
The data placed by proc is all in the memory, such as the system kernel, process, status of external devices and network status, etc. Because the data in this directory is in memory, it does not occupy any hard disk space.
procfs is an abstract file interface for Linux kernel information. A large number of kernel information and adjustable parameters are mapped to a directory tree as regular files, so that we can simply and directly use echo or cat. File operation commands are used to retrieve and adjust system information. At the same time, procfs also provides an interface so that our own kernel modules or user-mode programs can transfer parameters through procfs. In today's Linux systems, a large number of system tools also obtain kernel parameters through procfs, such as ps, lspci, etc. Without procfs, they may not work properly.
The proc file system is a pseudo file system. It only exists in the memory and does not occupy external memory space. It provides an interface for accessing system kernel data in the form of a file system. Users and applications can obtain system information through proc and change certain parameters of the kernel. Since system information, such as processes, changes dynamically, when a user or application reads a proc file, the proc file system dynamically reads the required information from the system kernel and submits it.
The /proc directory on the Linux system is a file system, that is, the proc file system. Different from other common file systems, /proc is a pseudo file system (that is, a virtual file system). It only exists in memory and does not occupy external memory space. It uses a file system to access system kernel data. Operation provides an interface), which stores a series of special files that store the current kernel running status. Users can use these files to view information about the system hardware and currently running processes, and even change the running status of the kernel by changing some of these files.
Directory, each process currently running in the system has a corresponding directory in /proc Below, the PID number of the process is used as the directory name.
directory, which provides security Relevant attributes are readable and writable. To support security modules such as SELinux, CONFIG_SECURITY needs to be configured.
file, ELF interpreter information, the format is an unsigned long type ID plus an unsigned long type value , and finally two 0s (man getauxval).
file, the control group to which the process belongs, the format is three fields separated by colons, respectively Structure ID, subsystem, control group, CONFIG_CGROUPS needs to be configured.
File, write-only, only used by the owner of the process, clear for estimating memory usage There are four strategies 1, 2, 3, and 4 for the amount of PG_Referenced and ACCESSED/YOUNG. 1 means clearing all related pages, 2 means clearing related anonymous pages, 3 means clearing related mapping file pages, and 4 means clearing related pages. For soft-dirty pages, CONFIG_PROC_PAGE_MONITOR needs to be configured.
File, read-only, saves the complete command line string to start the process, if it is a zombie process, this file is empty.
File, command name of the process, different threads (man clone prctl pthread_setname_np) may be different The thread name is located in "task/[tid]/comm". If the name exceeds TASK_COMM_LEN, it will be truncated.
file, coredump filter, such as 00000037 (man core), different binary bits represent filtering Different information.
file, node that controls CPU and memory (man cpuset).
directory, a symbolic link to the current working directory.
File, environment variable.
file, symlinked to the full command to start the process. q
directory, containing the current fd, these fd symbolic links to the actual open files.
Directory contains information about the current fd. Different types of fd have different information.
file, information about group IDs mapped from user namespaces (man user_namespaces).
File, IO information.
File, resource soft and hard limits (man getrlimit).
file, the audit daemon enables auditing tools in the kernel. Any process running before auditing is turned on in the kernel will get loginuid 4294967295.
4294967295 is just (unsigned long) -1. -1 means loginuid is not set. This is normal behavior for processes not spawned by any login process (such as a daemon). loginuid defaults to -1; whenever you log in (in tty/in DM/via ssh), the pam_loginuid module changes it to your user ID, and the value is retained by the child process.
Directory, including some memory mapped files (man mmap), the file name format is BeginAddress-EndAddress , the symbolic link to the mapped file needs to be configured with CONFIG_CHECKPOINT_RESTORE.
File, memory mapping information.
file is used to access the memory pages of the process through open, read, and lseek.
File, mount information, format is 44 41 253:1 // rw,relatime shared :35 master:1 - ext4 /dev/vda1 rw,data=ordered, with spaces as separators. The meanings of each field from left to right are the unique mount ID, the parent mount ID, and the device master-slave number of the file system. , the root node mounted in the file system, the mount point relative to the process root node, mount permissions and other mounting configurations, optional configurations, dashes indicate the end of the previous optional configurations, file system types, file system specific The mounting source may be none or additional configuration.
File, file system list mounted in the current process, /dev/vda1/ext4 rw ,relatime,data=ordered 0 0 Format reference (man fstab).
File, mount information, format is device /dev/vda1 mounted on / with fstype ext4[statistics].
Directory, saves network-related files and directories of the process.
directory saves the entry of each namespace, see (man namespaces) for details.
file, numa is Non Uniform Memory Access, see (man numa) for details.
file, adjust the OOM score. OOM is Out Of Memory. When OOM occurs, OOM Killer kills the process with a high score based on the OOM score. The default value is 0 and will inherit the settings of the parent process.
File, OOM score.
##root -> The / directory is linked to the root directory of the current process.
##sched file, scheduling statistics and status information of the process.
setgroups file, if the process containing the process pid in the user namespace is allowed to use setgroups(2) System call, the /proc/[pid]/setgroups file displays the string "allow"; if setgroups(2) is not allowed in the user namespace, "deny" is displayed. Note that regardless of the value in the /proc/[pid]/setgroups file (and regardless of the capabilities of the process), calling setgroups(2) is not allowed if /proc/[pid]/gid_map has not been set.
smaps Files, memory mapping information, similar to the pmap command, need to configure CONFIG_PROC_PAGE_MONITOR.
stack file, the function call stack of the kernel space, needs to be configured with CONFIG_STACKTRACE.
statm file, process memory usage information, 7 numbers separated by spaces, from left to right Respectively represent the total size of the program, resident memory size, shared memory page size, text code, library, data stack, and dirty pages.
syscall file, system call related information, needs to configure CONFIG_HAVE_ARCH_TRACEHOOK.
task Directory, one subdirectory for each thread, and the directory name is the thread ID.
timers file, POSIT timer list, including timer ID, signal and other information.
wchan file, the symbolic representation of the corresponding location in the kernel when the process is sleeping, such as do_wait.
acpi/wakeup file, device wakeup operation.
buddyinfo file, used to diagnose memory fragmentation problems.
bus Directory, installed bus.
cgroupscgroups information summary, field subsys_name hierarchy num_cgroups enabled.
cmdline file, parameters passed to the Linux kernel when the system starts, such as lilo, grub and other boot management module.
file, to view the currently used device line characters in the system console /dev/console, you can simply View the /proc/console file. file, CPU and system architecture information, use the lscpu command this file. file, the encryption list provided by the kernel encryption API. files, device related information. File, disk status. file, dma is Direct Memory Access. file, linked to /self/mounts. File, Memory Type Range Registers. directory, related to the network pseudo file system. file, other page allocator information. File, partition information. file, scheduler debug information. file, scheduler information. Directory, SCSI interface device. directory, linked to the directory where the current process is located. file, kernel cache information, CONFIG_SLAB needs to be configured. file, system soft interrupt information. File, system and kernel statistics. File, swap partition usage. Directory, system variable related information. File, writable, triggers system call. directory includes three files: msg, sem, and shm, which are System V IPC objects. file, list of timers that are still running. File, timer status. Directory, tty device related. File, system update time and process idle time. file, kernel version information. file, virtual memory allocation information. file, memory statistics, displayed in the form of key-value pairs. file, memory block information, used to analyze the behavior of virtual memory. Related recommendations: "Linux Video Tutorial"
file, execution domain list.
file, Frame Buffer information, CONFIG_FB needs to be configured.
File, file system type supported by the kernel (man filesystems).
Directory, mounted file system information.
file, interrupt information for each IO of each CPU. The irq number, the number of times each CPU processes the irq, the name of the interrupt controller, the name of the irq, and the name used by the driver to register the irq are displayed in sequence.
File, IO memory mapping information.
file, IO port information.
directory, the following will create a subtitle with the irq number as the name for each registered irq. Table of contents.
file, used for dynamic linking and symbol definitions bound to modules.
file, physical memory in ELF format in the system.
file exposes the list of keys that the reading thread has permission to view and provides information about each Various information for each key. The thread is not required to own the key, which is visible in this file.
file that lists every user who has at least one key on the system Various information about the ID.
file, kernel log information, this file is used by the dmsg command.
file, the number of times each physical page frame is mapped, needs to be configured CONFIG_PROC_PAGE_MONITOR.
file, the mask of each physical page frame, needs to be configured CONFIG_PROC_PAGE_MONITOR.
file, current system load.
File, the current file lock status.
file, virtual device information (soft raid, etc.).
file, system memory usage statistics, this file is used by the free command.
# files, drivers registered on other major devices (device number 10).
file, module information loaded by the system, the related command is lsmod.
The above is the detailed content of What file system is proc under linux?. For more information, please follow other related articles on the PHP Chinese website!