Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 10: Filesystems without Persistent Storage


transmission quality of the network because it also includes incorrectly transmitted and rejected
packages as well as collision data.

Some network card drivers (e.g., for the popular IntelPRO/100 chipset) create additional subdirectories
in/proc/netwith more detailed hardware-specific information.

System ControlParameters


The system control parameters used to check and modify the behavior of the kernel dynamically make
up the lion’s share of entries in theprocfilesystem. However, this interface is not the only way of manip-
ulating data — this can also be done using thesysctlsystem call. This requires more effort because it
is first necessary to write a program to support communication with the kernel via the system call inter-
face. As a result, the numeric sysctl mechanism was tagged as being obsolete during development of 2.5
(the kernel outputs a warning message to this effect each timesysctlis invoked) and was planned to be
dropped at some point. Removing the system call has, however, created a controversial discussion, and
up to 2.6.25, the call is still in the kernel — although a message warns the user that it is deprecated.

Thesysctlsystem call is not really needed because the/procinterface is a kernel data manipulation
option of unrivaled simplicity. The sysctl parameters are managed in a separate subdirectory named
/proc/sys, which is split into further subdirectories in line with the various kernel subsystems:

wolfgang@meitner>ls -l /proc/sys
total 0
dr-xr-xr-x 0 root root 0 2008-02-15 04:29 abi
dr-xr-xr-x 0 root root 0 2008-02-15 04:29 debug
dr-xr-xr-x 0 root root 0 2008-02-14 22:26 dev
dr-xr-xr-x 0 root root 0 2008-02-14 22:22 fs
dr-xr-xr-x 0 root root 0 2008-02-14 22:22 kernel
dr-xr-xr-x 0 root root 0 2008-02-14 22:22 net
dr-xr-xr-x 0 root root 0 2008-02-14 22:26 vm

The subdirectories contain a series of files that reflect the characteristic data of the associated kernel
subsystems. For example,/proc/sys/vmincludes the following entries:

wolfgang@meitner>ls -l /proc/sys/vm
total 0
-rw-r--r-- 1 root root 0 2008-02-17 01:32 block_dump
-rw-r--r-- 1 root root 0 2008-02-16 20:55 dirty_background_ratio
-rw-r--r-- 1 root root 0 2008-02-16 20:55 dirty_expire_centisecs
-rw-r--r-- 1 root root 0 2008-02-16 20:55 dirty_ratio
-rw-r--r-- 1 root root 0 2008-02-16 20:55 dirty_writeback_centisecs
...
-rw-r--r-- 1 root root 0 2008-02-17 01:32 swappiness
-rw-r--r-- 1 root root 0 2008-02-17 01:32 vfs_cache_pressure
-rw-r--r-- 1 root root 0 2008-02-17 01:32 zone_reclaim_mode

Unlike the files discussed earlier, the contents of the files in these directories can not only be read, but also
supplied with new values by means of normal file operations. For instance, thevmsubdirectory includes
aswappinessfile to indicate how ‘‘aggressively‘‘ the swapping algorithm goes about its job of swapping
out pages. The default value is 60, as shown when the file contents are output usingcat:

wolfgang@meitner>cat /proc/sys/vm/swappiness
60
Free download pdf