session

~/chopper

article

cgroup

Introduction

cgroup is a linux mechanism that partitions and limit how much system resources that a group of processes can consume such as CPU, memory and disk I/O. Think of cgroup like a virtual cages where you can group different processes and set relative rules for different groups. cgroup ensures that processes get resources they need while preventing others from hogging everything.

Why is it used

  • Resource Management - cgroup is used for resource management where it can limit how much system resources that a group of processes can consume.
  • Prioritisation - cgroup allows prioritisation of resource assessment, ensuring critical processes get resources necessary to perform important tasks.
  • Accountant - cgroup can be used to track system resources being used by each group.
  • Isolation - cgroup provides isolations of groups depending on the purpose of processes in each group, ensuring that each group sees its own view of world.
  • Containerisation - cgroup is a building block of containerisation mechanism. Containerisation and Orchestration tools like Docker and Kubernetes use cgroup under the hood to get isolation of containers.

cgroup operates through hierarchical structure, where root cgroup encompasses all processes on your system. Every child cgroup has its root cgroup and adapt every rules of its parent cgroup but capable of further refining those limits. Those structures allow you to organise processes and apply different resource policies to different groups.