Operating systems: How does kernel interact with hardware?

what is kernel?
how it is interact with hardware?
please give me reply with example ................................

Replies

  • Leo
    Leo
    Re: Operating system

    Kernel is interface between hardware and shell.
    Kernel code is written for efficient working on hardware, files and interconnected devices.
    Shell is code written for user to interact with hardware.

    I'll try to explain in an easy way i hope you will understand. For example Linux has its Kernel code which loads after POST(Power On Self Test) into memory. The original Kernel Code was written and developed by Linus Trovalds in early 1990's, at present day many changes are made to that kernel but the original was written mostly written in C language. Kernel specially provides interaction of user as well as device drivers with hardware as well as virtual devices like files and folders. The Linux Kernel was written as a application interface via which every other program can easily access resources without any deadlock condition. Here is further explanation how it works.

    Now you are user working on Linux BASH(Bourne Again Shell) shell also known as basic shell. You might enter some command for listing all folders of same name, now files and folders are nothing but virtual devices. Now the command you entered in shell will load the program responsible for execution of command and that program will interact with Linux Kernel, Linux Kernel might include several micro/macro-kernels(a small part of total kernel code written for interaction with specific device ex. kernel for ROM, kernel for hard disk) from which it selects macro-kernel responsible for interaction with Virtual Devices which again selects micro-kernel for interaction with files and folders. When kernel completes its job it returns the result to main Linux kernel which returns this result to program responsible for execution of your command and the original shell displays the result in user friendly manner. Device Kits and Device Drivers are nothing but Application Interface designed for interaction with hardware which use exchange of stream of bits for intercommunication where Kernel acts as API between them and hardware. Due to which programs with GUI also have to use Kernel.

    You might be wondering why use Kernel when the task can be directly accomplished by mere program, its just because when several program will try to access same device for some operation, Kernel will resolve all conflicts and results will not be error prone, due to which Linux is one of the most stable OS of all time which can work even on small amount of memory.

    Be free to ask whatever you haven't understood.Happy Computing.
  • ramana_slv
    ramana_slv
    Re: Operating system

    Thanks Leo.. I understood....

    In operating system virtual memory is exist. How these virtual memory is used by operating system and how these virtual memory increased.please tell me .......................
  • sushant005
    sushant005
    Re: Operating system

    ramana_slv
    Thanks Leo.. I understood....

    How these virtual memory is used by operating system
    First i will tell you how virtual memory concept introduced.

    We all know that the instruction are copied to the main memory from the HDD to perform specific/certain task.Now a days applications/ programs are getting larger and require larger space so if our main memory does not have sufficient memory to hold those data, instructions then to solve this concept the concept of virtual memory is introduced.however, we can add another main memory to the system but is costly and sometimes your system may not support additional RAM this led to the evaluation of the concept of Virtual memory. This what how virtual memory concept is introduced and now What is Virtual memory?

    Simply virtual memory is the portion of HDD memory used by the operating system. or Virtual Memory is a memory that uses a portion of HDD space as the memory to store the application data and instruction that the system demaded. Virtual Memory can be known as the logical memory, and it controls by the Operating System.
    Adding the Virtual Memory can be done in system configuration.

    Now How it works and operated by the operating system?

    During the program loading process, the system will copy the application data and its instruction from the HDD into the main memory for its processing.So if the system memory gets filled up, then the system will start moving some of the data and instruction into the virtual memory that don't need to process anymore until those data and instruction need to process again. So the system can call the next data and instruction and copy it into the main memory . When the data and instruction i.e in the virtual Memory needs to process again, the system will first check the main memory for its space. If there is space then it will simply transfer those to the main memory. If there are not any space left for the main memory, the system will first check the main memory and move any data and instructions that doesn't need to be process into the virtual Memory. And then swap the data and instruction that need to be process by the system from the Virtual Memory into the main memory.

    So virtual memory is used only for the temporary storage and not for any operation.
    I hope all these information make you clear about how OS used virtual memory
  • Morningdot Hablu
    Morningdot Hablu
    Good explanation sus.
    @ ramana_slv try to follow this in order to manually set the virtual memory system properties->advanced tab->advanced->virtual memory->change
    now you can manually set the size of virtual memory.
    .
  • sushant005
    sushant005
    As said by the mohit is correct you can manually set the size of the virtual memory.You can reduce as well as maximize the size.But i think default size is the best don't increase or decrease the size of virtual memory.
  • Leo
    Leo
    Re: Operating system

    sushant005
    First i will tell you how virtual memory concept introduced.

    We all know that the instruction are copied to the main memory from the HDD to perform specific/certain task.Now a days applications/ programs are getting larger and require larger space so if our main memory does not have sufficient memory to hold those data, instructions then to solve this concept the concept of virtual memory is introduced.however, we can add another main memory to the system but is costly and sometimes your system may not support additional RAM this led to the evaluation of the concept of Virtual memory. This what how virtual memory concept is introduced and now What is Virtual memory?

    Simply virtual memory is the portion of HDD memory used by the operating system. or Virtual Memory is a memory that uses a portion of HDD space as the memory to store the application data and instruction that the system demaded. Virtual Memory can be known as the logical memory, and it controls by the Operating System.
    Adding the Virtual Memory can be done in system configuration.

    Now How it works and operated by the operating system?

    During the program loading process, the system will copy the application data and its instruction from the HDD into the main memory for its processing.So if the system memory gets filled up, then the system will start moving some of the data and instruction into the virtual memory that don't need to process anymore until those data and instruction need to process again. So the system can call the next data and instruction and copy it into the main memory . When the data and instruction i.e in the virtual Memory needs to process again, the system will first check the main memory for its space. If there is space then it will simply transfer those to the main memory. If there are not any space left for the main memory, the system will first check the main memory and move any data and instructions that doesn't need to be process into the virtual Memory. And then swap the data and instruction that need to be process by the system from the Virtual Memory into the main memory.

    So virtual memory is used only for the temporary storage and not for any operation.
    I hope all these information make you clear about how OS used virtual memory
    That is really simple and nice explanation by Sushant, i don't know why i am not able to explain things in that easy way. Good job.
  • Manish Goyal
    Manish Goyal
    Very nice explanations sus

    You have explained this in a very nice way

    why don't you make a article on this ,that can explain all this in understandable way?
    we can create a nice collection of such articles
  • sushant005
    sushant005
    @Goyal and leo thanks for appreciating...
    @Goyal :Thanks for advice, i started writing some articles on that....
  • ramana_slv
    ramana_slv
    Thanks friends......... I under stand clearly .............................

    What is difference between windows kernel and ohter operting system kernel(Linux,solaris,Mac...) ? please tell me..............
  • Leo
    Leo
    Hi Ramana i don't know wheather there are new changes done to Windows Kernel but following features are applied to Microsoft OS which use NTFS file system.
    Windows Kernel is specially designed keeping in mind the performance of system. Windows Kernel are designed for two modes of working.
    -User Mode
    -Kernel Mode(H/W mode)

    User mode kernel only helps running applications and user level system services.
    Whereas Kernel Mode is reponsible for management of Memory , IO,Virtual Memory, Process, Threads, files and filters, Devices, cache and even Windows GUI.

    Kernel mode again is devided into 3 modes in Windows
    1.NTOS mode:Includes DLLs, scheduling and all user level background system services
    2.HAL(Hardware Adaptation Layer):Includes handling of Hardware Abstarction Layer, devices and avoiding deadlocks.
    3.DRIVERS EXTENTION:Needs for extending capability of Kernels.

    Windows Kernels are specially desinged for
    Relaibility: Nothing should be able to crash system, and if it crashes then there is bug which will be fixed in update.
    Security: Which i still think is a bigger joke than before.
    Portability: OS must run on any kinda hardware or Processing Architecture. This potabilty does not apply for platform.
    Extention; Timely extention of OS and its components.
    Compatibility :Application must run at any cost. This is main reason why Windows crash ans we face BSD.
    Performance: Absolutely nothing should compromise on speed. Main reason of memory overload crashing OS and faulty memory mangement.
  • Leo
    Leo
    ramana_slv
    What is difference between windows kernel and ohter operting system kernel(Linux,solaris,Mac...) ? please tell me..............
    Hi Ramana,
    So far as Linux is concerned we can write complete book on Linux Kernel features so i am going just in very basic, i hope you will not mind.
    Linux Kernel is very first thing that loads after Boot Loader. If we look it carefully Linux Kernel is total different OS than the OS we are running over it. In other words Linux Kernel is just an OS working job of your OS keeping you unaware of its presence. Kernel Layer is very first layer in Linux architecture above hardware, so there is no double view that Linux kernel is solely responsible for managing everything in Linux from GUI to hardware, from files to schedulers, from cache to IO, absolutely everything . The memory module of Linux is designed for making it liable to run on possible minimum memory and hence Linux is still capable of running on even a 15 year old computer.

    Linux Kernel follows all features of Portable Operating System Interface (POSIX) standards, where X stands for Unix just because this standard was developed before Linux for Unix. Which means Linux kernel is not only strong, sturdy, robust, secure, real portable(Platform and Hardware), but also performing. The main exiting feature of Linux Kernel is that it takes responsibility of your system and automatically protects your PC from crash, overheating and overload. In fact i never actually got anything to point a finger on as a limitation. It is only OS to use concept of macro Kernels after Unix & Minix, first Kernel to apply preemption, uses IO subsystem and User Mode Linux feature just makes it awesome for not only developers but also for general users, it is better than any Windows Kernel ever developed. The only fault it faces in working capability with respect to Windows in detecting Blue-tooth devices if single blue-tooth device holds several devices in it, but still stronger than Windows in working place because while "process sleep mode" Windows might terminate the active transfers via blue-tooth but such thing never happens in Linux so no matter it goes to process sleep mode transfers always complete whatever may be the size of file.

    I think that was quite easy and sufficient explanation for Linux Kernel, and i hope you will understand. Happy Computing
  • ramana_slv
    ramana_slv
    Thanks Leo........I understood clearly ......................
  • Shia.prasad14
    Shia.prasad14
    what are the main concepts to learn in linux device driver programming
  • Prakhars92
    Prakhars92
    I am studying embedded systems, and wanted to design Linux based embedded systems.
    Can anybody tell me what is the difference between linux we use in PC and linux we use in an embedded systems.
  • Madhu.M
    Madhu.M
    Hi one more doubt i ave how BIOS interact with hardware?can anybody tell me pls
  • Akhil C Joy
    Akhil C Joy
    Hi

    BIOS stands for Basic Input/Output System.
    It is the interface between software and hardware that allows them to communicate and interact with each other.

    once consider the how computer works we have to think it as a layered architecture.

    A Application can only communicate with the operating system through the API or Application Program Interface.

    The API is a set of common functions that the application calls upon to get the operating system to do what it wants. Because the API is operating system-specific, it differs from operating system to operating system.

    The operating system then communicates to the BIOS what it needs to carry out the application's request. The operating system never communicates directly with the hardware.

    The BIOS layer allows the operating system to support all manners of hardware. Each piece of hardware comes with its own BIOS and/or driver, which become part of the system's BIOS.

    Therefore, the BIOS layer is dynamic and changes to match the computer's hardware configuration. It serves to mask the differences between different hardware by presenting a common interface to the operating system.

    Important Note: Kernal is the heart of the OS, but it is not the BIOS, the BIOS is like the pre-os that gets the ball rolling
  • ambrish gautam
    ambrish gautam
    hi,
    i want to lean how to write kernel, firmware in c language. but i am an electronic engineer i dont know the concept of computer, then how can i proceed further in order to learn the programming for kernel?
  • Abhishek Rawal
    Abhishek Rawal
    - You need to master in C.
    - Clear your OS concepts. (Refer Galvin & Tannenbaum's book)
    - Networking concepts is pretty useful too if in future you are involved in device driver development of networking devices.

    Linux device drivers by Greg KH is an awesome book if youre interested in linux device driver development.
  • Kaustubh Katdare
    Kaustubh Katdare
    'How to' would need a big tutorial that'd be out of scope for this discussion. You'll find ample tutorials online on how to write Kernel. But as #-Link-Snipped-# said, you'll need solid grasp of C programming language. I'd recommend that you should start playing with Linux and make yourself familiar with how things work at the base.

You are reading an archived discussion.

Related Posts

Hi all! 😀 Name: Abhi student B Tech 2nd year(India) Hobbies: Chess, psychological astrology, reading novels
Hi all! I am in B tech 1st year(college life just started 😉 ) From now I have make up mind for CAT. But I always wanted to enter IIT....
can some body post the details about the hcl hiring process for releasing offer letter/?
What is displacement current and conduction current and how they are produced ? Does change in magnetic field produces current ? what is the name of current produced by magnetic...
We are searching for topic related to mobile applications. Please suggest some related ideas. Ideas on cloud computing are also welcome.