The Kernel: How Programs Share One Computer
A browser, a document editor and a music player can all need the same computer at once. Each wants memory, time on the processor and access to hardware. The kernel helps decide how that shared machine gets used.
The kernel is the core software of an operating system. It coordinates resources and handles requests between running programs and hardware. It is software, rather than a physical chip or the desktop you see on the screen.
What Is a Kernel?
Sharing the processor, memory and devices
Suppose a Linux laptop is running a music player and a document editor. Each running program is a process. When they need processor time, the kernel schedules which processes use the CPU, the processor that executes instructions.
The kernel also manages memory and works with device drivers, software that connects the operating system with hardware. Red Hat's explanation of the Linux kernel describes these everyday responsibilities.
What happens when the editor saves
To save its document, the editor asks the operating system to write data to a file. In Linux, a system call is a basic way for a program to ask the kernel to perform a service.
Applications commonly reach these calls through a software library: reusable code that handles parts of the request. The Linux system-call reference includes services for file operations and network communications.
The editor supplies the data it wants written. The operating system handles the lower-level work of performing the file operation. The kernel doesn't have to understand why a paragraph is bold to help save the bytes representing it.
Between requests, the editor can do work of its own. It uses system calls when it needs a kernel service.
- Finally understand what the commands you type are doing behind the scenes.
- Fix problems yourself instead of pasting in fixes you found online and hoping.
- Go from following tutorials to knowing why they work, one clear chapter at a time.
Why a mistake near the kernel can spread
The boundary also concerns privileges: the reach that executing code is allowed to have.
Windows calls the two execution modes user mode and kernel mode. Ordinary applications run in user mode, each with its own private address space—the memory addresses available to it. They cannot normally reach memory reserved for the operating system.
Core operating-system components run in kernel mode. Many drivers do, too, though some drivers run in user mode. Kernel-mode code shares an address space, so it lacks the same isolation that separates ordinary applications.
A faulty Windows kernel-mode driver can therefore overwrite important data used by other core code. Its crash can bring down the operating system. Microsoft's description of these modes explains why the effect can be much wider than one app closing.
These are modes of code execution, not names for the person signed in. Being an administrator doesn't make every instruction in an app run in kernel mode.
Protecting the kernel itself
The kernel can contain security flaws, just as other software can. Linux's self-protection work aims to prevent certain kinds of bugs, make it harder for attackers to use flaws and detect attacks. Examples include limiting the interfaces other software can call and preventing running code from being freely rewritten in memory.
A loadable kernel module adds code to the kernel, extending its functions. This can supply useful capabilities, but the added code runs in that same privileged space. A hostile module gains a reach that an ordinary application normally lacks.
Root: The Account Behind a Program’s Administrative Power

Linux Kernel Capabilities: Which Powers Does a Program Need?

Loadable Kernel Modules: Adding a Driver Without a Restart

QUOTE:
"Amateurs hack systems, professionals hack people."
