Role of namespaces and controlgroups in containerization
Published On: 2019/11/24
The main two features of linux kernel which helps to achive containerization are namespaces and controlgroups.
Namespace
The namespace feature helps to partition the kernel resources into groups according to the requirement of each group.
Analogy: A similar example in the Non-IT world is a House, a big space is partitioned into separate rooms. All rooms are not alike and we call each room/space a name (Living room, Kitchen, etc…).
Due to this partitioning, the processes in one namespace only sees the resources that are allocated to it.
Controlgroup
Control groups or generally know as cgroups is the feature which limits, isolates and measures resource usage of group of processes.
Analogy: Take the example of a internet/electricity provider who sets the limits, isolates and measures the supply to each subscriber.
Resources quotas for memory, CPU, network and IO can be set using control groups which is the core part of the containerization.
Containerization
Using the above two features, when a system creates a subunit/area by allocating a portion of its resources like memory, CPU, network, IO etc… we call it containerization. Docker is one of the technologies to achive containerization. You can find here the article on docker.
Conclusion
I have tried in article to give a brief idea on the features of linux kernal which enables the containarization.