The kernel at the heart of an operating system
How the kernel mediates access to hardware, manages resources, and organizes its responsibilities.
Read the Korean original on Velog ↗English translation

Applications do not have to control hardware directly because the kernel handles that boundary. A request passes through a system call to reach devices and shared resources.
What is a kernel?
The kernel is the core of an operating system. It manages hardware resources and provides controlled access to them for applications.

Kernels and interfaces
The kernel and the user interface are separate parts of a system. Different interfaces can run on the same kernel and give users very different experiences. Unix-like and Windows systems have different kernel traditions; command-line shells such as sh are interfaces above the kernel, rather than the kernel itself.
System calls and device drivers
Applications use system calls to request access to protected resources instead of accessing them directly.

A device driver enables communication between the operating system and hardware. Devices following a supported standard can use an existing driver; other devices may require one from the manufacturer.
Kernel responsibilities
| Responsibility | Purpose |
|---|---|
| Process management | Allocate CPU time and provide the environment needed for execution. |
| Memory management | Allocate process memory and support virtual address spaces. |
| File-system management | Provide ways to store and access data. |
| Input and output | Coordinate access to input and output devices. |
| Interprocess communication | Let processes exchange information and cooperate. |
Kernel architectures
Monolithic architecture
- Core operating-system services run together in kernel space.
- Direct communication between services can be efficient.
- Tight coupling can make faults harder to isolate and changes harder to manage.
- A failure in one component can affect the entire system.
- Early Unix is a familiar example; modern monolithic kernels can also support modular components.

Layered architecture
- Related responsibilities are grouped into layers with defined interfaces.
- This structure makes dependencies clearer than in an entirely unstructured design.
- A fault can often be investigated within a particular layer rather than across the whole system.
- Real operating systems can combine layering with other architectural approaches.

Microkernel architecture
- Only a small set of fundamental services remains in the kernel; other services run outside it.
- Separation can improve fault isolation and portability.
- Communication between services introduces its own tradeoffs.
- Apple's XNU combines Mach and BSD components and is a hybrid design, rather than a pure microkernel.

Virtual machines
A virtual machine presents a virtual hardware environment to a guest operating system. Multiple guests can run on one host, improving compatibility and isolation. Virtualization adds resource and execution overhead, so performance depends on the workload and implementation.

Further reading: Apple: XNU kernel.