Abstract
- An Abstraction Barrier between software and hardware
- Resides inside the Kernel Space
Loose Coupling
Software doesn’t need to know the complexity of hardware. It can use the hardware thought a standard interface called System Call (系统调用)
Common Modern Kernels
- MacOS’s kernel is XNU
- Windows’s kernel is NT Kernel
- Linux Kernel
Preemptive Kernel
- Kernel that can be interrupted and scheduled just like Process (进程) in the User Space
Avoid Kernel Hogging
Prevent kernel from hogging the CPU that slows down user space process
Kernel Module
- Known as Kernel Extension in the context of MacOS and IOS
- Extend the functionality of the Kernel
- FUSE is a kernel Module for example
Application of Kernel Module in Linux
The functionalities of the Linux Kernel is group into different Kernel Modules which can be either disabled, enabled or rendered toggle-able at compile-time
We also able to add/remove/disable Kernel Modules during runtime using the
modprobe
command
Kernel Booting
- Get configuration info from BIOS
- Check for missing Device Driver
- Start up Init System
- Initialise Page Table
- Starts up OS System Program
- OS is booted up and ready to be used by the User
Kernel Architecture
Micro Kernel Architecture
- Kernel only handles critical part of the system. The rest runs in User Space
- Different kernel components communicate with each other via Inter-Process Communication (IPC)
- Used by MINIX
Fault-tolerant
If one of the kernel Process (进程) crashes, this doesn’t crash the entire system
Less Performant
Due to the overhead of communication between different modules
Components of Traditional Microkernel
There are no Device Driver and File System etc
Monolithic Kernel Architecture
- By far, the most common Kernel architecture, used by Linux Kernel
- The entire kernel runs as a single program in Kernel Mode
- Consist of a collection of Procedures, linked together into a single large executable binary program. Each Procedures in the system is free to call any other one
Performant
No much overhead to call any of the kernel procedures
Harder to Maintain
Thousands of procedures that can call each other without restriction may also lead to a system that is difficult to understand
Not So Fault-tolerant
A crash in any of these Procedures will take down the entire Kernel