What is a Kernel?
Introduction
Linux is often referred to as the entire operating System but in reality, Linux is the Operating System Kernel that is started by the bootloader. A bootloader is a software that is launched first after the system is turned on.
Although we cannot change our default kernel of our system if we don't have a root access.
Luckily we have a root access in Kali Linux.
Various Tasks Handled By Kernel
- Driving Hardware
- Unifying File Systems
- Managing processes
- Right Management
So lets talk about these processes in detail below.
--> Driving Hardware\
So basically Kernel is the medium of communication between Software and Hardware .It detects and configure hardware when computer is powered on or when a device is inserted or removed. So a better kernel is required for better performance of a system. Slow Kernel can result to slow system.
The exports data about detected hardware thorough the /proc/ and /sys/ virtual file systems
Application often access device by way files created by within /dev/
Specific Files represented
- disk drives [ /dev/sda ]
- partition [ /dev/sda1 ]
- keyboards [ /dev/input/event 0]
- mice [ /dev/input/mouse0]
- Sound Cards [ /dev/snd/*]
- Serial number [ /dev/ttys/*]
There are basically two types of devices files :-
- Character : A character (c) device is one which the driver communicate by sending and receiving single character(bytes, octates ). Eg - Sound-cards , Serial ports , parallel ports.
- Block : A block ( b ) device is one which the driver communicates by sending block of data . Eg - camera ,harddisk,etc.
you can access these directories by a simple shell command (cd) which means change directory.
File Systems area prominent aspects of kernel. Unix like systems merge all the file stores into a single hierarchy , which allows user and applications to access by knowing its location within that hierarchy .The starting point of this hierarchical tree , represented by the "/" character. This directory can contain named sub directories.For instance ,the home sub directories of / is called /home/. The Kernel stores all data in one file starting with /root .
There are many file systems like are ext2 , ext3 , ext4 , VFAT ,etc.
Important commands like mkfs .ext3(where mkfs stands for Make FileSystems) handle formatting . These commands require , as a parameter a device file representing the partition to be formatted(for instance, /dev/sda1). This command is very destructive and should be used once unless u want to delete whole FileSystem and start fresh.
There is a also a network file system such as NFS , which do not require to store data in local disk and.Instead Data is transmitted through network or server.
-->Managing process
A process is a running instance of a program , which require memory to store both the program itself and its operating data .The kernel is in charge of creating and tracking processes. When a program runs, the kernel first set aside some memory ,loads the executable code running.
It keeps information about this process , the most visible of which is an identification number known as the process identification number(PID).
Is single processor Linux Systems are capable of multi tasking ?
Linux OS are capable of multi-tasking and capable of performing many tasks at a same time. BUT IN REALITY ITS ONLY TASK IS RUNNING AT A TIME . What the kernel does is slice CPU time into small time slices. These time slices are very short usually a milliseconds. This happens so fast that its like too many tasks running parallel but in reality it is happening so fast that it seems parallel. Kernel adjust these tasks accordingly to the priority. These tasks are only active at that time and rest of the time it is idle. Now kernel do everything to maximise the global system performance.
- Now if a task is running for longer period of time then it may not appear as responsive as desired .
- If time slices are too short then it may lose time for frequently switching between tasks.
The decision can refined with process priorities , the higher priorities will run for longer periods and more frequent time slices than low-priority processes .
How multi-processors systems perform multi-tasking ?
The multi-processors , multi-core , hyper-threaded Systems allow several tasks running in parallel. But here also time-slicing Systems are used to handle where there is more active processes than available cores . Normally a systems are running tons of running processes almost everytime.
The kernel allows several instance of same programme to run, but only in their time slices.
Unix -like systems support multiple users and group and allow separate permissions for them . Most of the time a process is identified by its user who started it. The kernel manages the rights of its user or owner or root.
Comments
Post a Comment
If u have any doubt then let me know