Monday, 29 October 2012

What is Kernel, its functions and Is Linux a kernel or an OS?


WHAT IS KERNEL, ITS FUNCTIONS, IS LINUX A KERNEL OR OS?




·        WHAT IS A KERNEL????

Hmmm….Basically we can define a Kernel is the main component of most computer operating systems. It provides an interface between applications and actual data processing at the hardware level.

Kernel is considered as the Heart of an Operating System. Kernel provides the lowest-level abstraction layer for the resources (especially processors and I/O devices) that application software must control to perform its function. It makes these facilities available to applicaton processes through Inter- Process Communication (IPC) mechanism and System Call.


TYPES OF KERNEL:
·         MONOLITHIC KERNEL,
·         MICROKERNEL, and
·         HYBRID KERNEL.

Since Linux system is having a Monolithic Kernel, so it can execute all the operating system code in the same address space to increase the performance of the system, whereas Microkernel runs most of the operating system services in user space, for example as servers, aiming to improve maintainability and modularity of the operating system.


·        BASIC FUNCTION OF KERNEL:
As we have seen above that kernel is the Engine of any Operating System, so all the vital functions should e controlled and managed by kernel itself. There are various tasks and functions of a kernel but some of the important are given below:

1.   Resource allocation- The kernel's primary function is to manage the computer's resources and allow other programs to run and use these resources. These resources are- CPU, Memory and I/O devices.


2.  Process Management- A process defines which memory portions the application can access. The main task of a kernel is to allow the execution of applications and support them with features such as hardware abstraction.
To run an application, a kernel first set up an address space for the application, then loads the file containing the application's code into memory, then set up a stack for the program and branches to a given location inside the program, thus finally starting its execution.


3.  Memory Management- The kernel has full access to the system's memory. It allows processes to safely access this memory as they require it. Virtual addressing helps kernel to create virtual partitions of memory in two disjointed areas, one is reserved for the kernel (kernael space) and the other for the applications (user space).


4.  I/O Device Management- To perform useful functions, processes need access to the peripherals connected to the computer, which are controlled by the kernel through Device Drivers. A device driver is a computer program that enables the operating system to interact with a hardware device. It provides the operating system with information of how to control and communicate with a certain piece of hardware.
A kernel maintains a list of available devices. 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. The kernel provides the I/O to allow drivers to physically access their devices through some port or memory location.


5.  Inter- Process Communication- Kernel provides methods for Synchronization and Communication between processes called Inter- Process Communication (IPC). There are various approaches of IPC say, semaphore, shared memory, message queue, pipe (or named fifo), etc.


6.  Scheduling- In a Multitasking system, the kernel will give every program a slice of time and switch from process to process so quickly that it will appear to the user as if these processes were being executed simultaneously. The kernel uses Scheduling Algorithms to determine which process is running next and how much time it will be given. The algorithm sets priority among the processes.


7.  System Calls and Interrupt Handling- A system call is a mechanism that is used by the application program to request a service from the operating system. System calls include close, open, read, wait and write. To access the services provided by the kernel we need to invoke the related kernel functions. Most kernels provide a C Library or an API, which in turn invokes the related kernel functions.
 There are few methods by which the respective kernel function can be invoked- using Software- Simulated Interrupt, or using a Gate Call, or by using a Special System Call Instruction and by using a Memory- based Queue.


8.  Security or Protection Management- Kernel also provides protection from faults (error control) and from malicious behaviors (Security). One approach toward this can be Language based protection system, in which the kernel will only allow code to execute which has been produced by a trusted language compiler.


·        WHAT IS LINUX- a KERNEL OR an OS?????
Whenever someone talks about LINUX or Linux Systems, usually most of the times people gets confused with the name called “LINUX”. Questions may arise in one’s grey matter such as- “What the Linux actually is? “, “Whether is it a Kernel or an OS?”, and many more…..
To solve this query, firstly we need to take a look on the basic architecture of a Linux System. The figure shown below gives a simplified view of the Linux System:










Now, many times we heard that Linux is an UNIX- like operating system which basically comprises of many free and open source development software and applications but don’t get confused with this stuff. So, A LINUX is a kernel, not an Operating System (OS) because Linux Kernel handles the above mentioned functions to provide an user application access to the hardware and also, it does not constitute applications, utilities, windowing system, compiler, editors, graphical interfaces or Desktops, etc. with itself. Whereas OS includes all components like kernel, file system and applications, etc. An OS provides both User Space and Kernel Space.


If these applications and utilities get together with the Linux Kernel then they forms a bonanza package, which is known to be an operating system. For example- many distribution companies include various Applications and Utilities with Linux Kernel and make these Linux kernel based OS available to all. Some of them are- redHat, Ubuntu, Fedora, Suse, Debian, centOS, BackTrack, etc.

About the Author

keertendra

Author & Editor

Hobbyst Researcher and working in electronics domain, M.Tech in VLSI Design and Embedded Systems.

10 comments:

  1. good deffrentiate b/w kernel and os

    ReplyDelete
  2. your blogs is awesome.
    videocon internet data plan
    Rs.13
    *141*13# 2 Days,80MB data.

    ReplyDelete
  3. thank you for this answer...

    ReplyDelete
  4. This is good, the wikipedia one was so complicated!

    ReplyDelete
  5. Good article it would be great if you mention a little about the other types of Kernel too.

    ReplyDelete
  6. Good description of kernel functionality...........................

    ReplyDelete
  7. I have an exam today your blog helped. Thanks

    ReplyDelete
  8. Thx realy helpful www.buybestfootcream.com

    ReplyDelete
  9. you delivered in a very simplified way.. superb.

    ReplyDelete
  10. i have similar content will give you more knowledge about kernel a very brief article.
    https://www.fawadkhan.me/what-is-kernel-in-the-operating-system/

    ReplyDelete

 
2embeddedrobotics © 2015 - Designed by Templateism.com