Linux is a popular operating system that powers many devices, from servers and desktops to smartphones and embedded systems. Linux is also known for its flexibility and customizability, allowing users to configure and optimize their system according to their needs and preferences.

One of the key features of Linux is its ability to manage the resources of the system, such as CPU, memory, disk, network, and devices. Linux uses a mechanism called cgroups (short for control groups) to organize and control the processes and tasks that use these resources. Cgroups allow users to create hierarchical groups of processes and assign them different resource limits, priorities, and policies. For example, cgroups can be used to:

- Isolate and limit the resources used by a specific application or service
- Guarantee or reserve a minimum or maximum amount of resources for a group of processes
- Monitor and measure the resource usage and performance of a group of processes
- Apply different scheduling or quality of service policies to a group of processes

Cgroups were introduced in Linux kernel 2.6.24 in 2008, and since then they have been widely adopted and used by various tools and frameworks, such as systemd, Docker, Kubernetes, and LXC. However, over the years, cgroups have also faced some challenges and limitations, such as:

- Complexity and inconsistency of the cgroup interface and configuration
- Lack of compatibility and interoperability between different cgroup controllers and subsystems
- Difficulty in managing and nesting cgroups across different levels of hierarchy
- Overhead and performance degradation caused by frequent cgroup operations

To address these issues and improve the resource management capabilities of Linux, a new version of cgroups, called cgroups v2, was developed and introduced in Linux kernel 4.5 in 2016. Cgroups v2 is a major overhaul and redesign of the cgroup mechanism, aiming to provide a simpler, more consistent, and more powerful way of controlling and managing the resources of the system. Some of the main features and benefits of cgroups v2 are:

- A unified and standardized cgroup hierarchy and interface, with a single mount point and a single set of files and commands for all cgroup controllers and subsystems
- A new delegation and inheritance model, which allows users to delegate and share the management of cgroups and resources to different processes and users, and to propagate the resource settings and policies across the cgroup hierarchy
- A new pressure stall information (PSI) feature, which allows users to monitor and measure the resource pressure and saturation of the system, and to detect and prevent resource starvation and contention
- A new threaded mode, which allows users to create and manage cgroups based on threads rather than processes, and to apply different resource settings and policies to individual threads within a process
- A new no internal process constraint, which prevents processes from escaping or moving between cgroups without the permission of the cgroup owner or administrator
- A new memory high and memory low feature, which allows users to specify the high and low thresholds of memory usage for a cgroup, and to adjust the memory reclaim and allocation behavior of the system accordingly
- A new memory min and memory max feature, which allows users to specify the minimum and maximum amount of memory guaranteed or reserved for a cgroup, and to enforce the memory isolation and protection of the cgroup
- A new io.latency feature, which allows users to specify the target latency for the disk I/O operations of a cgroup, and to adjust the I/O scheduling and throttling behavior of the system accordingly
- A new cpu.weight feature, which allows users to specify the relative weight or share of CPU time allocated to a cgroup, and to adjust the CPU scheduling and balancing behavior of the system accordingly

Cgroups v2 is not a replacement or a backward-compatible update of cgroups v1, but rather a parallel and alternative implementation of the cgroup mechanism. Cgroups v1 and cgroups v2 can coexist on the same system, but they cannot be mixed or nested within each other. Users can choose to use either cgroups v1 or cgroups v2, depending on their needs and preferences, and on the support and compatibility of the tools and frameworks they use. Cgroups v2 is still under active development and improvement, and new features and enhancements are being added and refined in each kernel release.

Cgroups v2 is a significant and exciting improvement of the resource management capabilities of Linux, and it offers many advantages and opportunities for users, developers, and administrators. Cgroups v2 is also a challenging and complex topic, and it requires a good understanding of the concepts, principles, and mechanisms of the cgroup mechanism. In this article, we have provided a brief introduction and overview of cgroups v2, and we have highlighted some of its main features and benefits. In the following articles, we will dive deeper into the details and specifics of cgroups v2, and we will show you how to use and configure cgroups v2 on your Linux system.