LFCS practice question 9 of 35

Which of the following statements is correct when talking about /proc/?

Full set: 260 questions
Answer options
A: All changes to files in /proc/ are stored in /etc/proc.d/ and restored on reboot.
B: All files within /proc/ are read-only and their contents cannot be changed.
C: All changes to files in /proc/ are immediately recognized by the kernel. Correct answer
D: All files within /proc/ are only readable by the root user.
Correct Answer:
C. All changes to files in /proc/ are immediately recognized by the kernel.
Explanation

The /proc filesystem is a pseudo-filesystem in Linux that provides an interface to kernel data structures. It is created in memory at boot time and does not consume disk space. Many of the files within /proc, particularly under the /proc/sys directory, are writable. Writing to these files allows for the dynamic, real-time modification of kernel parameters. The kernel acts on these changes immediately, without requiring a reboot or a service restart, making it a powerful tool for system tuning.

Why Incorrect

A. All changes to files in /proc/ are stored in /etc/proc.d/ and restored on reboot.: Changes to /proc are not persistent. The /etc/proc.d/ directory is not a standard location for this purpose.
B. All files within /proc/ are read-only and their contents cannot be changed.: This is incorrect. Many files, especially within /proc/sys, are writable to allow for kernel parameter tuning.
D. All files within /proc/ are only readable by the root user.: This is false. Many files like /proc/cpuinfo and /proc/meminfo are world-readable to provide system information to any user.

References

- proc(5) manual page. The "DESCRIPTION" section states, "It contains a hierarchy of special files which represent the current state of the kernel...". The /proc/sys subsection details how writing to these files can change kernel parameters.

- The Linux Kernel Documentation, Documentation/filesystems/proc.rst. This document describes the /proc filesystem, including the writable /proc/sys interface for "getting and setting kernel information."

- Love, R. (2010). Linux Kernel Development, 3rd Edition. Addison-Wesley Professional. Chapter 17, "Devices and Modules," discusses procfs as a mechanism for kernel-to-user-space communication, including writing to files to interact with the kernel.

Scroll to Top