Kernel Of An Operating System
kernel of an operating system is the “core” or “heartbeat” of the computer. It provides an interface between hardware and software and manages the computer programs. This is a core central component of an operating system that manages all operations of the computer and hardware system.
Its primary purpose is managing the system’s resources and allowing application programs to communicate with the computer hardware.
The kernel is an intermediator between applications and data processing performed at the hardware level using IPC (inter-process communication) and system calls.
The kernel is the first program of an operating system that loads into memory when the computer starts and stays there until the computer is turned off. It manages hardware resources and allows software applications to interact with the hardware.
It uses a process table to keep track of all active processes which is running on the computer system. This table is a data structure which is maintained in memory. Data structure holds information about each process of the computer system
Process Table:
It holds information about the processes that are currently handled by the OS. It decides which process will be allocated to the processor to execute and which process will be kept in memory to execute.
This is typically a list of process control blocks (PCBs). Each PCB contains detailed information about a single process. ||what is process||
PCB contains below information about a process
Process ID: Unique ID of each process
Process State:Â Keep the Current State of the process (Run, Wait, Stop)
Program Counter: Keep the address of the next instruction to be executed
CPU Registers: The values of the CPU registers for the process.
Memory Allocation Information: keep information about allocated memory.
Scheduling Information: Process: Priority and scheduling info.
Input/Output info: keep information about peripheral devices used by a process
CPU usage and Execution time
Example
Process ID (PID): 1234 Process number: Running Program counter (PC): 0x00400100 Register: R1: 0x00000005 R2: 0x0000000A Stack Pointer (SP): 0x7FFF0010 Other information: memory management information, I/O status, etc.
Create and Delete Process
When creating a new process, the kernel allocates a new PCB and populates it with the process’s startup data.
When a process terminates, the kernel removes its PCB from the process table and returns the resources.
Scheduling Process
using the process table, the kernel’s scheduler decides which process to run next. It examines the state and priority of each process as well as other scheduling information.
Context Switching
During a context switch, the kernel saves the state of the currently running process in its process table and loads the state of the next process from its PCB. This allows the CPU to switch from a running process to another process  for example
A computer running multiprogram like a web browser, a word processor, and a music player. The kernel keeps track of each program’s process in the process table. If you switch from the web browser to the word processor, the kernel saves the web browser’s state in its PCB and loads the word processor’s state from its PCB.
Main Key Point:
Control and manage process, memory, and storage in the system.
Keep process state information
Make an interface between the user and computer hardware.
Five Types of Kernel:
1. Monolithic KernelsÂ
2. Microkernels
3. Hybrid Kernels
4. Exokernels
5. Nanokernels
Monolithic Kernels
all system services, such as device drivers, file management, and system calls
Microkernels
run the most essential services in kernel space basic process and memory management, and inter-process communication
Hybrid Kernels
Combination of elements of both monolithic and microkernel architectures.
Exokernels
An experimental design that reduces core responsibilities and enables resource management for applications.
Nanokernels
provide the absolute bare minimum functionality required to manage hardware resources