Disk Operating System/The Kernel
What's a Kernel?Edit
The kernel is one of the most important parts of an operating system. The kernel creates an abstraction layer between the computer's hardware and the program(s) that are running. This means that the kernel takes care of a lot of things from handling interrupts to managing the graphics on the computer monitor. The kernel is one of the most critical parts of an kernel and as a result, a small bug within the kernel can cause the entire kernel to crash. Kernels can differ from other kernels since there is several ways to design a kernel, each with their advantages and disadvantages. The two main kernels that you'll learn about in this lesson are the monolithic kernel and the microkernel.
The Monolithic KernelEdit
The monolithic kernel is a kernel design that runs all of the operating system's programs inside the kernel space. This approach basically makes the kernel handle all of operating system's jobs like I/O, device drivers, and the file system. This creates a layer of abstraction for programmers, since the kernel handles and works with the hardware. Because the operating system is ran entirely inside of the kernel space, a small bug can cause the entire operating system to crash.
You should note that you do not need to keep all of the operating system jobs within the kernel, you could slice them up into system files and the kernel can load and unload them into memory. Slicing operating system Depending on your operating system, cutting your operating system into files is a great way to reduce memory footprint.
In contrast to the monolithic kernel, the microkernel tries to keeps the amount of work the operating system does in the user space. In this kernel design, things like device drivers are not built-in or handled in the kernel space, rather they are ran in the user space. This makes a device driver much more like a program you'd execute on your computer. If the device drivers fails or corrupts part of the memory, it will most likely destroy itself in user space and not anything critical in the kernel space. This allows the operating system to be stable even in the event of a device driver crashing. Another benefit of the microkernel is that it will be smaller when compared to a monolithic kernel, since the kernel will only contain the necessary functions to run the operating system.
The microkernel doesn't come without its costs. One of the main disadvantages to using a microkernel is the kernel's performance and speed take a hit. The first generation kernel's like Mach and the ChorusOS had poor performance and speed.
The Hybrid KernelEdit
The hybrid kernel is a kernel design that is a cross between the monolithic kernel and the microkernel. The objective of the hybrid kernel is to take advantage of both of the monolithic kernel and mircokernel's positives, while trying to reduce their negatives. Hybrid kernel preforms more of its jobs within the kernel space, but it doesn't do everything entirely within that space. In this type of kernel design you are free to implement somethings in the kernel, while leaving things, like drivers, to run within the user space. This type of kernel design allows you to preform critical operating within the kernel space, while running the potentially unstable part of your operating system within user space. Most modern operating systems use a hybrid kernel including the NT kernel, the XNU kernel, and the OS/2 Kernel.
The nanokernel is very similar to a microkernel. Hence the similarities, people refer to a nanokernel as being the same as a microkernel. Generally, the nanokernel has a few different features than a microkernel, mainly the nanokernel is meant to be smaller and faster than a microkernel. A picokernel has come to mean the same thing as a nanokernel.
The exokernel is one of most experimental kernel designs out of them all. The exokernel tries to remove the abstraction that is created by other kernel designs. The goal of a exokernel is to create a kernel that preforms just the bear minimum so that the operating system can function and so that abstraction is at a minimum. The exokernel is usually light weight and is generally smaller than a microkernel. Since the exokernel provides little abstraction between the hardware and the software, the software and the libraries it uses have a large amount of freedom in what they do, but they also need to work a lot close with the hardware. Proponents of this kernel design suggest that giving each program freedom to work with the hardware this closely will allow programs from different operating systems to run together, since each uses a library that is independent of the kernel. Though there is still some experimentation to be done on the exokernel, its hoped that this kernel design will be able to fulfill what later sentence state, along with other goals. Because it is still an emerging kernel design, I recommend that you do not use this kernel design for a disk operating system.
Choosing a Kernel ModelEdit