Cgroups (Control Groups) is a mechanism provided by the linux kernel that integrates (or separates) a series of system tasks and their subtasks into different groups by resource level according to requirements, thus providing system resource management. A unified framework. Simply put, cgroups can limit and record the physical resources used by the task group. Essentially, cgroups are a series of hooks attached to the program by the kernel. The corresponding hooks are triggered by the scheduling of resources during program execution to achieve resource tracking and restriction.
The main purpose of implementing cgroups is to provide a unified interface for resource management at different user levels. From resource control of individual tasks to virtualization at the operating system level, cgroups provides four major functions:
Resource limits: cgroups can limit the total amount of resources a task requires. For example, set the upper limit of the memory used when the task of the panel PC or tablet runs, and send OOM once it is exceeded.
Priority allocation: The number of CPU slots allocated and the disk IO bandwidth are actually equivalent to controlling the priority of the task in the Panel PC's system.
Resource statistics: cgoups can count the Panel PC system's resource usage, such as CPU usage, memory usage, and so on. This feature is ideal for current cloud products billed by usage.
Task Control: cgroups can suspend, resume tasks etc.