Sunday, October 9, 2016

systemd

We have talked about SysVinit on
SysVinit
Run level
Set a default runlevel

But actually SysVinit is less popular than "systemd" recently. Now we will talk about systemd here and go through the features of systemd.

In a system which uses systemd, systemd process manages services instead of init process when the system is started. The following daemon[1] processes work together for the purpose.
systemd  : main process of systemd
systemd-journald  : this manages journals (logs)
systemd-logind  : this is a process to deal with log in
systemd-udevd  : this process detects devices dynamically
In systemd, a unit refers to any resource that the system knows how to operate on and manage. This is the primary object that the systemd tools know how to deal with. These resources are defined using configuration files called unit files.[2]

There are some types of unit like a unit to start some services or a unit to mount a file system. Unit's type can be seen by its extension. For example, "htttpd.service"  can be estimated to be a service to start httpd service (and it is really so).

main types of the unit:
service
device
mount
swap
target.
systemd can understand the system's dependence and order relationship unlike SysVinit[3]. systemd considers "in order to start service A, service B will be needed" and systemd starts services smartly. In the end, necessary time to start the whole system is much shorter than SysVinit.


[1] Daemon processes reside in memory and provice services.
[2] Cited from Understanding Systemd Units and Unit Files.
[3] SysVinit starts services just in order stated beforehand. So if some service doesn't work properly, SysVinit get stuck at the service and it might take a lot of time to start the whole services as a result.