Linux for Developers
/Advanced
Namespaces
Definition
A Linux kernel feature that isolates and virtualizes system resources. A process inside a namespace only sees the resources (files, processes, networks) associated with that specific namespace.
Explain Like I'm New
The Matrix. It puts an application inside a virtual reality simulation. The application looks around and thinks it is the only program running on the entire computer, completely blind to the host system.
Real World Example
When Docker runs a container, it creates a PID (Process ID) Namespace. The app inside the container thinks it is Process #1. But if you look from the host server, you see the app is actually Process #4592. The namespace tricked the app.
Common Use Cases
- •Container isolation
- •Security sandboxing
Interview Questions
basic
- If cgroups limit 'How much' a container can use, what do namespaces limit?
intermediate
- What does a Network Namespace do?