The data in /proc
is not updated at all. It is generated on demand.
When you read from /proc
(or indeed from any file at all), you are calling into the kernel. If you're reading a "real" file, the kernel will then (subject to caching, permissions, etc.) traverse the filesystem and retrieve the data you requested. If you're reading a /proc
"file," the kernel will generate the relevant data on the fly.
This technique has become rather popular, and is now widely used in different areas of the filesystem. For instance, the /sys
virtual filesystem is very similar to /proc
from an architectural standpoint, though the contents are entirely different. On modern systems, you may find that /dev
is also a virtual filesystem, since it is otherwise rather painful to keep the files in /dev
up-to-date with hardware realities. Some userland services provide their own virtual filesystems through FUSE.
/proc/
, a full in-depth explanation of/proc/
was not the question, and a link that expands greatly on the subject was included. – Jason Rush Dec 16 '15 at 03:48