In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "what is the concept of cgroups of Linux". In daily operation, I believe that many people have doubts about the concept of cgroups of Linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "what is the concept of cgroups of Linux?" Next, please follow the editor to study!
Control groups, referred to as cgroups, is a mechanism provided by the Linux kernel to limit, record, and isolate the physical resources (such as cpu,memory,IO, etc.) used by process groups (process groups). It was originally proposed by google engineers and later integrated into the Linux kernel. Cgroups is also a resource management tool used by LXC to achieve virtualization. It can be said that without cgroups, there would be no LXC.
Starting with version 2.6.24, the linux kernel provides a feature called cgroups (Control Group). Cgroups is the 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, that is, a cgroup. Cgroups is divided into several subsystems, each subsystem represents a facility or resource controller, which is used to schedule the use of a certain type of resources, such as cpu clock, memory, block devices and so on.
Cgroups is suitable for a variety of application scenarios, from resource control of a single process to operating system-level virtualization (OS Level Virtualization). Cgroups provides the following features:
1. Limit the number of resources that a process group can use (Resource limiting). For example, the memory subsystem can set an upper limit of memory usage for the process group, and once the memory used by the process group reaches the limit, it will start OOM (out of memory).
two。 Priority control (Prioritization) of the process group. For example, you can use the cpu subsystem to assign a specific cpu share to a process group.
3. Record the number of resources used by the process group (Accounting). For example, you can use the cpuacct subsystem to record the cpu time used by a process group
4. Process group isolation (Isolation). For example: the use of ns subsystem can make different process groups use different namespace to achieve the purpose of isolation, different process groups have their own process, network, file system mount space.
Concepts related to Cgroups and their relationships
1. Task (task). In cgroups, a task is a process of the system.
two。 Control population (control group). A controlling group is a process divided according to certain criteria. Resource control in Cgroups is realized on the basis of controlling ethnic groups. A process can join a control group and migrate from one process group to another. The process of a process group can use cgroups to allocate resources in units of the control population, and is subject to the restrictions set by cgroups on the basis of the control group.
3. Hierarchy (hierarchy). The control population can be organized in the form of hierarchical, which is a control group tree. The child node on the control group tree the control group is the child of the parent node control group, inheriting the specific attributes of the parent control group.
4. Subsystem (subsytem). A subsystem is a resource controller. For example, the cpu subsystem is a controller that controls the allocation of cpu time. A subsystem must be attach to a level in order to work. After a subsystem is attached to a level, all control groups at that level are controlled by that subsystem.
interrelation
1. Each time a new level is created in the system, all tasks in the system are initial members of the default cgroup at that level (we call it root cgroup, this cgroup is created automatically when the level is created, and the cgroup created later in that level is a descendant of this cgroup).
two。 A subsystem can only be attached to at most one level.
3. Multiple subsystems can be attached to a level
4. A task can be a member of multiple cgroup, but these cgroup must be at different levels.
5. When a process (task) in the system creates a child process (task), the child task automatically becomes a member of the cgroup where its parent process resides. The subtask can then be moved to a different cgroup as needed, but it always inherits the cgroup of its parent task at first.
Introduction of Cgroups Subsystem
Blkio-this subsystem sets input / output limits for block devices, such as physical devices (disks, solid state drives, USB, etc.).
Cpu-this subsystem uses the scheduler to provide cgroup task access to CPU.
Cpuacct-- this subsystem automatically generates CPU reports used by tasks in cgroup.
Cpuset-this subsystem allocates independent CPU (on multicore systems) and memory nodes for tasks in cgroup.
Devices-this subsystem allows or denies tasks in cgroup access to the device.
Freezer-this subsystem suspends or resumes tasks in cgroup.
Memory-this subsystem sets the memory limits used by tasks in cgroup and automatically generates reports on memory resources used by those tasks.
Net_cls-this subsystem marks network packets with a level identifier (classid), allowing the Linux flow control program (tc) to identify packets generated from a specific cgroup.
Ns-- the namespace subsystem.
At this point, the study of "what is the cgroups concept of Linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.