Basic knowledge of cgroups in Linux

  
                

Linux cgroups can be used for physical memory control, suitable for a variety of application scenarios, because there are more things in cgroups, this article will give you a brief introduction to Linux cgroups, so that everyone has a preliminary understanding.

From the beginning version 2.6.24, linux kernel provides a feature called cgroups (control group). Cgroups is an abbreviation of control groups, which is used to limit, count, and isolate the resources occupied by a group of processes. It is also one of the foundations of the current lightweight virtualization technology lxc (linux container). Each set of processes is a control group, which is a cgroup. Cgroups are divided into several subsystems, each of which represents a facility or resource controller that is used to schedule the use of certain types of resources, such as cpu clocks, memory, block devices, and so on. In terms of implementation, cgroups does not add new system calls, but instead acts as a cgroup file system, which can mount one or more subsystems to a directory. For example, the

code is as follows:

mount -t cgroup -o cpu cpu /sys/fs/cgroup/cpu

Mount the cpu subsystem in /sys/Fs/cgroup/cpu. It is also possible to mount multiple subsystems in a single directory, or even all of them to a directory, but I think it would be more flexible to mount each subsystem in a different directory. Use mount

Copyright © Windows knowledge All Rights Reserved