No history yet

Introduction to systemd

What is systemd?

When you turn on a Linux computer, the first thing that loads is the kernel. But the kernel can't do everything on its own. It needs a special program to start up all the other services and processes that make the system usable, like your network connection, your graphical interface, and your login screen. This first program is called the init system, short for initialization. It's process ID 1, the ancestor of every other process on the system.

For a long time, the standard was a simple system called System V init, or SysVinit. But as computers and software became more complex, a more powerful solution was needed. Enter systemd.

systemd is a modern system and service manager for Linux operating systems. It was designed to overcome the limitations of older init systems and provide a more robust, efficient way to manage a running system.

Lesson image

The Old Way vs. The New Way

The traditional SysVinit system works sequentially. Imagine a checklist where you must complete task 1 before you can even look at task 2, and so on. It starts one service, waits for it to be fully running, and then moves on to the next. This process is reliable but can be slow, especially on systems with many services.

systemd takes a different approach. Instead of a linear checklist, it looks at the dependencies between services. If Service B needs Service A to be running, systemd ensures that happens. But if Service C doesn't depend on anything, systemd can start it at the same time as Service A. This parallel processing makes system startup much faster.

Key Features of systemd

systemd's speed comes from more than just parallel startups. It introduces several powerful features that change how a system is managed.

On-Demand Activation: systemd can listen for requests and start a service only when it's actually needed. For example, the printing service doesn't need to run all the time. systemd can keep it inactive until you try to print a document, at which point it starts the service automatically. This saves memory and CPU resources.

Better Resource Management: systemd uses a kernel feature called control groups, or cgroups. Think of cgroups as containers for processes. systemd places each service and its child processes into a dedicated cgroup. This makes it easy to see exactly which processes belong to which service. It also allows administrators to set limits on how much CPU, memory, or disk I/O a service can use, preventing a single misbehaving service from slowing down the entire system.

systemd is more than just an init system; it's a full suite of tools for managing a Linux machine. It handles logging, network connections, scheduled tasks, and user login sessions, providing a unified and consistent interface for system administration.

Quiz Questions 1/5

What is the Process ID (PID) of the init system on a Linux machine?

Quiz Questions 2/5

What is the primary difference in how systemd and the traditional SysVinit system start services?