Systems and protocols · Intermediate

Linux namespaces: different views of resources

Understand PID, network and mount views while keeping resource limits and shared-kernel risks separate.

Ask Logeia about this articleTry the three questionsReview your answers

Updated

On this page
  1. A namespace changes a view
  2. PID and network examples
  3. Resource quantities and privileges
  4. The shared-kernel boundary
  5. Ask Logeia about this articleCheck your understanding

A namespace changes a view

A Linux namespace wraps a resource so a group of processes sees its own instance of that resource. Different namespace types cover process identifiers, networking, mounts and other views. Namespaces are one of several mechanisms used to construct containers.

There is no single visibility switch that makes every resource independent at once. Behavior depends on which namespace instances processes share and which they do not. State the resource being separated rather than treating the word container as a complete explanation of isolation.

PID and network examples

With PID namespaces, one process can have different identifiers from inside and outside the namespace. PID 1 inside a container is not necessarily the host’s PID 1. When correlating logs and monitoring, record the viewpoint that produced the identifier.

A network namespace has its own view of networking resources such as interfaces and routes. Separate namespaces may allow apparently identical port bindings, but external reachability depends on additional forwarding and host configuration. Local listener success is not proof of publication to the outside network.

Resource quantities and privileges

A mount namespace can change the filesystem view without setting CPU time or memory capacity. Resource consumption controls involve other mechanisms, notably cgroups. A different view of a resource does not imply a different quantity of that resource.

Likewise, namespace membership alone does not make every operation safe. Capabilities, user namespaces and syscall restrictions also affect what a process can do. A useful design review separates shared resources, visible names and permitted operations instead of putting all three into one vague isolation claim.

The shared-kernel boundary

Containers commonly share a host kernel even when their namespace views differ. Their failure and attack boundaries are therefore not automatically equivalent to virtual machines running separate guest kernels. Choose the boundary according to the workload’s trust assumptions.

For learning, begin by reading namespace-related process information and comparing viewpoints. Entering another namespace with administrative tools can affect real processes or the host. Use a controlled environment and do not treat adding privileges as a necessary default. Observation can establish the main concepts without broadening access.

Reading and practice are recorded separately in this browser, for each language.

Learn this in order

Understand the systems behind the web · STEP 24

Choose a learning path