What are the main jobs of an operating system kernel, and what is the difference between a monolithic kernel and a microkernel?
Short answer: The kernel manages and protects the hardware for programs: it schedules the CPU, manages memory, provides file systems and device access, handles interrupts, enforces isolation and permissions, and offers all of this through system calls. A monolithic kernel (Linux) runs all of these services, including drivers, in kernel mode in one address space. A microkernel (QNX, seL4, Zircon) keeps only the minimum in kernel mode (scheduling, address spaces, IPC) and runs drivers, file systems and network stacks as user-mode servers.
The core responsibilities
- Process and thread management: create, schedule and terminate tasks; context switches.
- Memory management: virtual address spaces, page tables, allocation, protection, swapping.
- I/O and device management: drivers, interrupts, DMA, a uniform interface (files, sockets).
- File systems: names, directories, permissions, caching of persistent data.
- Protection and security: user vs kernel mode, user IDs, capabilities.
- Communication: pipes, signals, shared memory, sockets.
Monolithic vs microkernel
| Monolithic (Linux) | Microkernel (QNX, seL4) | |
|---|---|---|
| Drivers and file systems | in the kernel | user-space processes |
| Communication | function calls | message passing (IPC) |
| Performance | fast (no IPC per request) | extra context switches, though modern ones are efficient |
| Fault isolation | a buggy driver can crash the whole system | a crashed driver can be restarted |
| Code size in privileged mode | millions of lines | thousands (seL4 is formally verified) |
| Typical use | general purpose, servers, Android | safety-critical and automotive (QNX), secure systems |
Hybrid kernels (Windows NT, macOS XNU) mix the two. Linux reduces the monolithic disadvantage with loadable modules (but they still run in kernel mode) and moves some work to user space (FUSE file systems, UIO/VFIO drivers, DPDK networking).
Interview angle: in automotive and medical devices, the argument for a microkernel is certification: a small trusted kernel is easier to prove correct, and a failing driver does not take down safety functions.