π§Linux Control Groups (cgroups) Labs
π― Objective
π§° Prerequisites
sudo apt update
sudo apt install cgroup-tools stressmount | grep cgroupπΉ Lab 1: CPU Limit with cgroups
Step 1: Create a CPU cgroup
Step 2: Limit CPU usage to 25%
Step 3: Run a CPU-intensive task
Step 4: Monitor with top or htop
top or htopπΉ Lab 2: Memory Limit with cgroups (v1)
Step 1: Create a memory cgroup
Step 2: Set the memory limit to 100 MB
Step 3: Run a memory-hungry task
πΉ Lab 3: Monitor cgroup Stats
πΉ Lab 4: systemd-based cgroups (v2-style)
Step 1: Start a transient systemd unit with CPU limit
Step 2: Check status
πΉ Bonus: Inspect Process Membership
β
Wrap-Up
Last updated