Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 2: Process Management and Scheduling


Implementation


The implementation of namespaces requires two components: per-subsystem namespace structures that
wrap all formerly global components on a per-namespace basis, and a mechanism that associates a given
process with the individual namespaces to which it belongs. Figure 2-4 illustrates the situation.

struct task_struct

struct nsproxy

struct nsproxy

uts_namespc
user_namespc
mnt_namespc

uts_namespc
user_namespc
mnt_namespc

UTS Namespace

User Namespace

0

0

1

Tasks

struct task_struct

struct task_struct

Figure 2-4: Connection between processes and namespaces.

Formerly global properties of subsystems are wrapped up in namespaces, and each process is associated
with a particular selection of namespaces. Each kernel subsystem that is aware of namespaces must
provide a data structure that collects all objects that must be available on a per-namespace basis.struct
nsproxyis used to collect pointers to the subsystem-specific namespace wrappers:

<nsproxy.h>
struct nsproxy {
atomic_t count;
struct uts_namespace *uts_ns;
struct ipc_namespace *ipc_ns;
struct mnt_namespace *mnt_ns;
struct pid_namespace *pid_ns;
struct user_namespace *user_ns;
struct net *net_ns;
};

Currently the following areas of the kernel are aware of namespaces:

❑ The UTS namespace contains the name of the running kernel, and its version, the underlying
architecture type, and so on. UTS is a shorthand forUnixTimesharing System.
❑ All information related to inter-process communication (IPC) is stored instruct
ipc_namespace.
Free download pdf