NOTE
Linux Namespace
Namespaces give processes isolated views of system resources. These notes record Linux version support and the roles of different namespace types.
This is a historical learning note and may contain outdated or incomplete understanding.
1. History of Linux Namespace
- Linux kernel version 2.4 supported mount namespace.
- Linux kernel version 2.6 supported most namespaces, such as IPC, Network, PID, and UTS.
- Linux kernel version 3.8 supported User namespace.
2. What Is Linux Namespace?
limits what you can see A Linux kernel feature that isolates the resources a process can see. These resources include process IDs, hostnames, user IDs, file names, network access, IPC, etc.
3. Linux Namespace Categories
3.1. Mount (mnt)
Filesystem mount points.
3.2. Process ID (pid)
Process IDs.
3.3. Network (net)
Network devices, protocol stacks, ports, etc.
3.4. Interprocess Communication (ipc)
System V IPC, POSIX message queues, etc.
3.5. UTS
Hostname and NIS domain name.
3.6. User ID (user)
User IDs and group IDs.
4. Why Linux Namespace Is Needed
Resource isolation supports virtualization, such as containers.
5. How to Use Linux Namespace
5.1. View the namespace a process belongs to
/proc/[pid]/ns
5.2. clone()
Create a new process.
5.3. setns()
Allow a specified process to join a specific namespace.
5.4. unshare()
Disassociate the calling process from its current shared execution context, such as namespaces, and create a new context according to the specified flags.
7. How Linux Namespaces Work
8. References
- Linux namespaces - Wikipedia
- Linux Namespace: Introduction - CNBlogs
- What Are Some Impressive Designs in the Linux Kernel? - Zhihu
- What Is Linux Namespace and What Can It Be Used For? - Zhihu
- Linux Namespace: User - CNBlogs
- Linux Namespace: Network - CNBlogs
- Linux Namespace: PID - CNBlogs
- Linux Namespace: Mount - CNBlogs
- Linux Namespace: IPC - CNBlogs
- Linux Namespace: UTS - CNBlogs
Drag to pan, scroll to zoom, and click a node to expand or collapse it. Large maps start with deeper levels collapsed; click nodes to expand them.
Discussion
Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub