What is Kernel?
this is a great question.. and for who dunn know what is Kernel or never heard about this word.
Kernel is the Heart of most Computer Operating Systems.
it’s job managing System’s resources and communications between hardware and software.
Kernel’s Tasks:
The kernel’s task is to manage the computer’s resources and allow other programs to run and use these resources.
in a computers, the most central part is the Central Process Unit “CPU or Processor”, which actually runs different programs the way and for the amount of time dictated by the kernel
there are many different kernel design approaches like:
- Monolithic Kernels.
- MicroKernels.
- Hybrid Kernels.
- NanoKernels
- ExoKernels
Kernel Development Overview:
Kernel development is considered one of the most complex and difficult tasks in programming.
Its central position in an operating system implies the necessity for good performance, which defines the kernel as a critical piece of software and makes its correct design and implementation difficult.
A kernel might even not be allowed to use the abstraction mechanisms it provides to other software. Many reasons prevent a kernel from using facilities it provides, such as:
- interrupt management
- memory management
- and lack of reentrancy, thus making its development even more difficult for software engineers.
Kernel Development under:
- Time-Sharing Operating Systems.
- Unix.
- MAC OS.
- Windows.
Process Management:
The main task of an operating system kernel is to allow the execution of applications and support them with features such as hardware abstractions. To run an application, a kernel must load the file containing the code for the application to memory (and eventually set up its own address space), set up a stack for the program and branch to a given location inside the program, thus starting its execution.
Multi-tasking kernels are able to give the user the illusion that the number of processes being run simultaneously on the computer is higher than the maximum number of processes the computer is physically able to run simultaneously. Typically, the number of processes a system may run simultaneously is equal to the number of CPUs installed
The operating system might also support multiprocessors, in that case different programs and threads may run on different processors. To allow a kernel to run on such a system, it has to be extensively modified to make it “re-entrant” or “interruptible”, meaning that it can be called in the midst of doing something else. Once this conversion is complete, programs running at the same time on different processors can safely call the kernel. The kernel must also provide a way to synchronize memory access on different processors, which makes memory management and process management two highly inter-related topics
Memory Management:
The kernel has full access to the system’s memory and must allow userland programs to access this memory safely as they require it. Often the first step in doing this is virtual addressing, usually achieved by paging and/or segmentation. Virtual addressing allows the kernel to make a given physical address appear to be another address, the virtual address. This allows every program to believe that it is the only one (apart from the kernel) running and thus prevents applications from crashing each other.[citation needed] In fact, a program’s virtual address may even refer to data which is not currently in memory. The layer of indirection provided by virtual addressing allows the operating system to use other data stores, like a hard drive, to store what would otherwise have to remain in main memory (RAM). As a result, operating systems can allow programs to use more memory than the system has physically available. When a program needs data which is not currently in RAM, the OS writes the contents of a currently unused memory block to disk and replaces it with the data requested by the program.[citation needed] Virtual addressing also allows creation of virtual partitions of memory in two disjointed areas, one being reserved for the kernel (kernel space) and the other for the applications (user space). This fundamental partition of memory space has contributed much to current designs of actual generalistic kernels.
Device Management:
To perform, an operating system (OS) needs access to the peripherals connected to the computer, which are controlled through device drivers, which must be written by the developers and/or be provided by the manufacturers of the hardware. For example, to show the user something on the screen, the kernel relies on its monitor driver (such as VGA or VESA) which is then responsible for actually plotting the character/pixel.[citation needed] A device manager first performs a scan on different hardware buses, such as Peripheral Component Interconnect (PCI) or Universal Serial Bus (USB), to detect installed devices, then searches for the appropriate drivers. As device management is a very OS-specific topic, these drivers are handled differently by each kind of kernel design, but in every case, the kernel has to provide the I/O to allow drivers to physically access their devices through some port or memory location. Very important decisions have to be made when designing the device management system, as every access involves context switches, making the operation very CPU-intensive and easily causing a significant performance overhead.
System Calls:
To actually perform useful work, a userland program must be able to access the services provided by the kernel. This is implemented differently by each kernel, but most provide a C library or an API, which in turn invoke the related kernel functions either through the inter-process communication system, software interrupts or shared memory.