Skip to content

Processes

Dietmar Planitzer edited this page Sep 26, 2025 · 3 revisions

A process is an application or command line tool which a user runs to get some work or job done. A process which is started at one point and then continuously runs in the background to offer a service to other processes is known as a daemon or service process.

Process Resource Management

Every process manages a set of resources:

  • a set of virtual processors
  • an address space which manages all memory allocated to the process
  • a table of I/O channels representing things like files, directories and open connections to a device driver
  • a user and group id which specifies the identity of the user who owns the process

Processes automatically track their resources: all memory and virtual processors that have been allocated to a process and all open I/O channels are automatically closed and freed when the process is terminated.

Process Hierarchy

Processes are organized in a tree. A process creates a child process with the help of the process spawn API. A significant difference between Serena OS and POSIX systems is that child processes do not inherit the I/O channels of their parent process. A parent process has to explicitly declare which I/O channels a child process should inherit when it creates them.

The root of the process tree is the kernel processed named kerneld. This is the only process in the system that has all privileges available to it. The kerneld process spawns the systemd process which is a service process that is responsible for spawning and monitoring global services that should be available to all logged in users. One kind of process that systemd spawns is the login process. The login process is responsible for presenting the login user interface and logging in a user. It spawns a shell when a user logs in. The user can then use the shell to start whatever application they want to use.

Process Groups and Sessions

Each process has a unique id. This is a globally unique id that is used for example to identify a process for purposes of sending it a signal. Every process either belongs to a process group and a session or it is a process group or session leader.

Each process group has a globally unique id and this id corresponds to the process id of the process group leader. The same is true for process sessions: each one has a globally unique id which corresponds to the process id of the session leader.

The utility of a process group is that it allows you to organized related processes together and address them for purposes of sending signals with a single id. The same is the case with process sessions.

The difference between a process session and a process group is that the system automatically creates a process session for each logged in user. A process in session X is able to send a signal to all other processes in session X but it is not allowed by the kernel to send a signal to any other session Y, Z, etc. This security mechanism ensures that user X can not force terminate processes that belong to another user Y.

Clone this wiki locally