$linuxjunkies
>

cgroupfs

also: cgroup filesystem, cgroup virtual filesystem

A virtual filesystem that exposes Linux control groups (cgroups) as a hierarchical directory structure, allowing users and processes to manage resource limits for groups of processes.

cgroupfs is the filesystem interface to cgroups, typically mounted at /sys/fs/cgroup/ on modern systems. It presents cgroup hierarchies as directories and files that can be read and written using standard filesystem tools, making resource management accessible without specialized APIs.

Each cgroup subsystem (like CPU, memory, I/O) appears as a separate directory tree. For example, you can limit a process group's memory by writing to /sys/fs/cgroup/memory/mygroup/memory.limit_in_bytes. When a process is assigned to a cgroup by writing its PID to cgroup.procs, it becomes subject to those resource constraints.

This approach is fundamental to containerization: Docker and other container runtimes use cgroupfs to isolate and restrict resources for each container. The filesystem abstraction makes cgroups manageable for system administrators and applications without kernel-level programming.

Related terms