Operating System Kernel
What is an Operating System Kernel?
A kernel is the core of any computer system which has full control over the system’s performance. This basic core of an operating system is always present at any time. The interaction layer between both the hardware and the software is catered by OS Kernels and it is the first program that starts up at the time of boot up.
This part of the OS handles all the necessary operations such as handling the peripherals, I/O operations and selects the most suitable process to be executed next or any process which shall be temporarily blocked. OS kernel also tracks the system performance and memory load. Tasks such as memory management, task management, disk management and process management are performed by the OS. Every Operating system comes with a built in kernel so that a proper interaction between the hardware and the software can be instantiated.
Kernel runs in the background memory until the computer is shut down because it takes care of the various operations. Certain processes need to communicate with the operating system and to do that, they must first send the request to the intermediary between them which is the kernel. These requests are called as system calls which invoke the kernel so that the user’s desired operations are performed. Not everybody can access kernel data because it is loaded into protected memory of the operating system reserved for only the specified purpose, also known as the kernel space. Any application running other than kernel runs on a user space. Users usually deal with the lowest level of the kernel where the kernel communicates directly with the OS. The hardware software communication cannot be done directly due to the fact that systems only understand binary and natural language shall be converted to be interpreted by a system, and vice versa.
Core Functions of an Operating System kernel:
Kernel serves at the lowest abstraction of the OS and is the direct link between the hardware and the software layer. Some basic functions of the Kernel are:
- Process management: A process is something currently running on an operating system. As each running process requires some hardware, disk, memory and interrupts etc., the kernel is the one which makes sure which resources to be distributed to which process. The information between these processes is shared and a proper synchronization is done.
- Device management: One of the most core functions of OS is to manage all the devices associated with the Operating system. It manages all the hardware, software, storage and input / output devices. OS kernels make sure the status is shared and tracked via the device drivers and controllers which are composed of three kinds of registers; commands, status and data.
- Memory management: Initially all the processes are saved in the disk and have space allotted there, where it’s like a pool of processes. The process of transferring these from the disk space to the main space where they run on the foreground is memory management. The kernel moves the processes back and forth in the same way and keeps track of the allocated space. The decision of freeing or assigning memory to any process is performed in memory management. The three types of addressing done here are symbolic, relative and physical.
- Interrupt handling: This task is done by the interrupt handler of the Kernel. An interrupt is a signal sent to the kernel upon a request by a system call. A process may continue to work until an interrupt by another process is sent and requested to be brought to the main memory. This task allocation is done by the kernel reviewing the most suitable interrupts caused.
- I/O communication: The communication of the hardware devices, specifically the input and output devices require the kernel to act as an intermediary between the hardware and the software layer. Thus, these devices send requests to the kernel which then sends back interrupts and schedules them to be taken into account and executed accordingly.
Types of OS
The heart of the operating system which is responsible for every task, a kernel, has various types:
- Monolithic Kernel: As the OS is divided into user space and kernel space where kernel space is dedicated to only kernel specific tasks, the monolithic kernels are those types of kernels which enable both these spaces to have a shared space In the memory. By following this approach, the size of the kernel gets increased which in turn expands the size of the operating system. The processes and tasks performed here execute much faster as the transfer of space isn’t required. Scheduling tasks and file management here are done only by system calls. UNIX can be taken as the example of a monolithic kernel.
- Micro Kernel: It is different from a monolithic Kernel in a sense that both the user and kernel spaces possess different space in the memory address. Because both share the space, it reduces the size of the kernel which in turn reduces the size of the operating system. The communication done here is done by message parsing which is indeed slower and reduces the size of execution. In this kernel, new services can be easily added. Its example is Mach.
- Hybrid Kernel: As the name suggests, a hybrid kernel is a combination of both monolithic kernel and microkernel as it possesses the properties of both. Both the plus points of these kernels are used by hybrid kernel; speed from monolithic kernel and modularity by the micro kernel. It has different parts running in different parts of the memory; some run in the user space and some in the kernel space. Its examples are Windows NT and Windows CE.
- Nano Kernel: Following the name code, this type of kernel contains the code which is very small. This kernel mainly uses the name Nano because it supports nanosecond clock resolution.
- Exo kernel: This type of kernel is very extreme as it facilitates application-specific customization as the resources protection is placed at a different memory space than its management. The distinctive feature which makes it separate from monolithic and microkernels is that it supports no force abstraction.
Each of the types of kernels has their own pros and cons and shall be addressed accordingly, by carrying a preliminary research. No matter what the kernel, it performs the same operations but the speed and location varies. All and all, the kernel structure is the core of the operating system and no operating system can work without it.