惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
The Register - Security
The Register - Security
S
Secure Thoughts
有赞技术团队
有赞技术团队
Hacker News - Newest:
Hacker News - Newest: "LLM"
月光博客
月光博客
Engineering at Meta
Engineering at Meta
www.infosecurity-magazine.com
www.infosecurity-magazine.com
WordPress大学
WordPress大学
N
News | PayPal Newsroom
F
Fortinet All Blogs
Forbes - Security
Forbes - Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Y
Y Combinator Blog
L
LINUX DO - 最新话题
Google Online Security Blog
Google Online Security Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
阮一峰的网络日志
阮一峰的网络日志
Application and Cybersecurity Blog
Application and Cybersecurity Blog
V2EX - 技术
V2EX - 技术
H
Heimdal Security Blog
G
Google Developers Blog
Vercel News
Vercel News
Martin Fowler
Martin Fowler
TaoSecurity Blog
TaoSecurity Blog
腾讯CDC
Cyberwarzone
Cyberwarzone
罗磊的独立博客
S
Securelist
T
Tor Project blog
Recorded Future
Recorded Future
小众软件
小众软件
Attack and Defense Labs
Attack and Defense Labs
L
LINUX DO - 热门话题
The Cloudflare Blog
爱范儿
爱范儿
S
Security @ Cisco Blogs
雷峰网
雷峰网
Schneier on Security
Schneier on Security
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
S
Schneier on Security
大猫的无限游戏
大猫的无限游戏
Recent Announcements
Recent Announcements
Blog — PlanetScale
Blog — PlanetScale
D
Docker
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
酷 壳 – CoolShell
酷 壳 – CoolShell
Latest news
Latest news
M
MIT News - Artificial intelligence

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
cgroups and Namespaces — The Linux Kernel's Building Blocks Behind Containers
William Kwabena Akoto · 2026-05-31 · via DEV Community

Every container you have ever run is, at its core, a process with a restricted view of the world and a capped share of the machine's resources. That restriction and that cap come from exactly two kernel features: namespaces and cgroups. Everything else is plumbing.


The Problem They Solved

Long before Docker, system administrators wrestled with a deceptively simple question: how do you run multiple workloads on the same machine without them interfering with each other?

The classical answers were clunky. Separate physical machines were expensive. Full virtual machines were slow to boot and heavy on resources. chroot jails, introduced in Unix back in 1979, changed a process's view of the filesystem but nothing else. A chrooted process still shared the same process table, network stack, and user database as everything else on the host. The walls only went up in one direction.

What the industry needed was something built into the kernel itself, some that is lightweight enough to start in milliseconds, safe enough for multi-tenant workloads. Linux delivered that in two independent features merged roughly a year apart: namespaces (first type in 2002, full suite by 2013) and cgroups (2007).


Namespaces — A Selective Blindfold

A namespace wraps a global system resource and gives each participating process its own isolated instance of it. The process believes it has exclusive ownership. The kernel is quietly managing multiple independent copies underneath.

There are eight namespace types, each isolating a different dimension of the system:

Mount (CLONE_NEWNS) — The first and oldest. Isolates the filesystem mount table. A container can have its own /etc/hosts, its own /proc, its own root filesystem and none of it visible to the host or other containers.

PID (CLONE_NEWPID) — The first process in a new PID namespace gets PID 1, regardless of its real PID on the host. This is why containers need an init process (tini, dumb-init), PID 1 is responsible for reaping orphaned children, and a naive application as PID 1 will silently accumulate zombie processes.

Network (CLONE_NEWNET) — Isolates the entire network stack: interfaces, routing tables, iptables rules, port bindings. Each new network namespace starts with only a loopback interface. Container runtimes wire it to the outside world via veth pairs, thus, virtual Ethernet cables with one end inside the container and one on the host. This is why two containers can both listen on port 8080 without conflict.

User (CLONE_NEWUSER) — The most powerful and the last to be merged (Linux 3.8, 2013). Maps UIDs inside the namespace to different UIDs on the host. A process can be root (UID 0) inside a container but map to an unprivileged UID like 100000 on the host. This is the foundation of rootless containers, no setuid binaries, no elevated privileges required.

UTS, IPC, Cgroup, Time — Isolate hostname, System V IPC objects, the cgroup hierarchy view, and monotonic clocks respectively. Less glamorous, all essential.

Three syscalls drive everything: clone() creates a process in new namespaces, unshare() moves the calling process into new ones, and setns() joins an existing namespace by file descriptor. The nsenter tool is a thin wrapper over setns() and that's exactly how docker exec attaches to a running container's namespaces.


cgroups — The Resource Accountant

Namespaces answer "what can a process see?" cgroups answer "what can a process consume?"

The project started at Google in 2006. Engineers Paul Menage and Rohit Seth were running enormous shared Linux clusters which were the internal system that eventually became Borg and then Kubernetes. ulimit which is a built in command in Unix/Linux shells to check, set or restrict the amount of system resources a process or user can consume, wasn't cutting it. ulimit is per-process. There was no way to say: this entire group of processes, however many they fork, shall not exceed 2 GB of RAM.

The initial name was "process containers", which caused enough confusion with the broader container concept that Paul Menage renamed the feature to control groups (cgroups) before merging.

version 1: Powerful but Fragmented

cgroups version 1 (Linux 2.6.24, 2008) lets you organise processes into a hierarchy and attach controllers, a subsystems that enforce limits on specific resources. The hierarchy is a pseudo-filesystem under /sys/fs/cgroup/.

The critical innovation was group-level accounting. When a memory-limited cgroup hits its ceiling, the OOM killer fires within that group, not across the whole machine. Noisy neighbours became a solved problem.

But version 1 had real issues: each controller could have its own independent hierarchy tree, making it impossible to atomically apply a consistent resource profile. The interfaces were inconsistent across controllers. Fixes accumulated as improvised additions.

version 2: One Hierarchy to Rule Them All

cgroups version 2 (Linux 4.5, 2016) made one foundational change: a single unified hierarchy with all controllers attached to it. The fragmentation was gone.

version 2 also added PSI (Pressure Stall Information) which is a Facebook contribution that exposes how much time processes are spending waiting for CPU, memory, or I/O rather than running. Raw usage numbers tell you what's consumed; PSI tells you when a resource is actually causing slowdowns.

The Controllers That Matter

CPU: Two modes. Weights (cpu.weight) give proportional shares of CPU during contention which is useful for fairness. Bandwidth (cpu.max) is a hard cap expressed as quota/period:

# Allow 50% of one CPU (50ms out of every 100ms)
echo "50000 100000" > /sys/fs/cgroup/myapp/cpu.max

Enter fullscreen mode Exit fullscreen mode

Memory: The soft limit (memory.high) slows processes down and triggers reclaim when crossed. The hard limit (memory.max) triggers the OOM killer within the cgroup. These two knobs together let you apply back-pressure gracefully before resorting to killing.

PID: A simple ceiling on total processes+threads a cgroup can create. The defense against fork bombs in containers.

Block I/O: Per-device read/write bandwidth and IOPS limits — critical for preventing a log-spewing service from saturating shared disk.


How They Work Together

Namespaces and cgroups are orthogonal but designed to combine. A container is their intersection:

Concern Mechanism
What processes are visible PID namespace
What filesystem is visible Mount namespace
What network exists Network namespace
How much CPU can be used cgroup cpu controller
How much memory can be used cgroup memory controller
How many processes can exist cgroup pids controller

The Open Container Initiative Runtime Specification formalises this combination. A container bundle is a root filesystem plus a config.json that declares which namespaces to create and what resource limits to apply. runc, the reference runtime, translates this spec into the actual kernel calls clone(), setns(), writes to /sys/fs/cgroup/ and then execs the entrypoint.

When you run docker run, the call chain is:

Docker CLI → dockerd → containerd → containerd-shim → runc → kernel syscalls

Enter fullscreen mode Exit fullscreen mode

runc's entire job is configuring namespaces and cgroups, then handing off to your application.


Kubernetes on Top

Kubernetes sits several layers above the kernel but its abstractions map directly back down to cgroups.

Each node's cgroup tree under /sys/fs/cgroup/kubepods/ mirrors the pod QoS hierarchy:

  • Guaranteed pods (requests == limits): hard cpu.max and memory.max set to the requested values.
  • Burstable pods (requests < limits): proportional CPU shares, memory limited to the limit value.
  • BestEffort pods (no requests or limits): lowest CPU shares, placed in a group that's evicted first under memory pressure.

When you write resources.limits.memory: 512Mi in a pod spec, the kubelet writes 536870912 to that container's memory.max file. When that container exceeds it, the OOM killer fires and that's the OOMKilled pod status you've seen in kubectl describe pod. It's the kernel doing its job, surfaced through the Kubernetes API.


Conclusion

The entire container ecosystem thus Docker, Kubernetes, Fargate, Lambda, GitHub Actions runners are built on two kernel primitives that are, conceptually, not complicated:

Namespaces change what a process can see. cgroups change what a process can consume.

That's it. Everything above, the image layers, the registries, the schedulers, the service meshes are tooling built to make working with those two primitives at scale more ergonomic.

When a pod OOM-kills, read memory.events. When a job is mysteriously slow, check cpu.stat for throttling. When containers can't talk to each other, trace the network namespace. The kernel tells you everything, you just need to know where to look.