What Does an Operating System Do?

When using a computer, we open browsers, run commands in a terminal, and save files. These actions feel natural because the operating system hides the complexity of the hardware beneath them.

The role of an operating system can be summarized in two parts. First, it abstracts hardware so that applications can function without knowing the details of the underlying devices. Second, when multiple programs run simultaneously, it fairly distributes resources like CPU, memory, and disk among them. Without these two functions, every program would need to control hardware directly, and there would be no way to prevent conflicts between programs.

What Is a Kernel?

The core component of an operating system is the kernel. The kernel is the only software that communicates directly with hardware β€” all applications can access hardware only through the kernel.

Are the kernel and the operating system the same thing, then? Strictly speaking, no. An operating system is a broader concept that includes the kernel plus system libraries, shells, and utilities. The name Linux officially refers only to the kernel. What we commonly call Linux is actually a distribution that combines this kernel with GNU tools and various software.

User Space and Kernel Space

Linux divides memory into user space and kernel space. This separation exists for stability and security.

Programs running in user space cannot access hardware directly. To read a file, they must request it from the kernel through a system call. The kernel verifies that the request is legitimate, performs the hardware operation, and returns the result. Without this separation, any program could overwrite arbitrary regions of disk or read the memory of other processes.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          User Space                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ bashβ”‚ β”‚nginxβ”‚ β”‚pythonβ”‚ β”‚ javaβ”‚  β”‚
β”‚  β””β”€β”€β”¬β”€β”€β”˜ β””β”€β”€β”¬β”€β”€β”˜ β””β”€β”€β”¬β”€β”€β”€β”˜ β””β”€β”€β”¬β”€β”€β”˜ β”‚
β”œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€
β”‚        System Call Interface         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚          Kernel Space                β”‚
β”‚  Process Mgmt β”‚ Memory Mgmt β”‚ VFS   β”‚
β”‚  Networking   β”‚ Device Drivers       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚             Hardware                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The CPU itself supports this separation at the hardware level. In the x86 architecture, there are privilege levels called Ring 0 (kernel mode) and Ring 3 (user mode). If user mode code attempts to execute a kernel mode instruction, the CPU raises an exception. This hardware protection mechanism forms the foundation of operating system stability.

Key Subsystems of the Linux Kernel

The Linux kernel consists of several subsystems, each responsible for managing a specific domain of resources.

SubsystemRole
Process ManagementProcess creation, scheduling, termination
Memory ManagementVirtual memory, paging, memory allocation
File System (VFS)File read/write, abstracting various file systems
NetworkingTCP/IP stack, sockets, packet processing
Device DriversCommunication with hardware devices
IPCInter-process communication (pipes, signals, shared memory)

These subsystems work together to provide a unified environment. For example, when a web server processes a client request, the networking subsystem receives packets, process management schedules worker processes, and the file system reads static files into memory β€” all happening concurrently.

Monolithic Kernel vs Microkernel

There are two main approaches to kernel design. A monolithic kernel compiles all subsystems into a single large binary that runs in the same address space. A microkernel keeps only minimal functionality in the kernel and separates the rest into user-space server processes.

Is the microkernel a superior design? In theory, yes. Isolation between modules is stronger, and if one subsystem crashes, the entire system doesn't halt. In practice, however, the frequent context switches between user space and kernel space create performance overhead that becomes problematic.

Linux uses a monolithic kernel. However, through a mechanism called kernel modules, functionality can be dynamically loaded and unloaded, compensating for the rigidity of a purely monolithic design. Device drivers are a prime example β€” they can be loaded into memory only when needed and released when no longer in use.

What This Series Covers

This series will examine the internal workings of the Linux kernel one by one. We'll look at how processes are created and scheduled, how virtual memory operates, how file systems manage data, and ultimately how containers leverage all of these kernel features.

In the next post, we'll look at processes and threads in Linux.