What is a kernel ?
A kernel is the part of the operating system that mediates access to system resources. It's responsible for enabling multiple applications to effectively share the hardware by controlling access to CPU, memory, disk I/O, and networking.
In simple words, a kernel is an interface between hardware and OS It takes commands from OS and make hardware act upon and takes data from hardware and gives it to OS. It also provides inter process communication.
kernel has two execution levels:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOmqDvH31bVaOLRhSm7ZWrhNPpWs6lKoe9hU3NXsCOY4hbAUeMEna3SBc6vXFheuIpLqmFqmHX0HfA-wvwTU9EOqpxEumkEumFXCufM3gCcq3KlczlW58XUBU-a_CoTML4MEPnnleQo6I/s320/unix2.gif)
Kernel space
Code running in the kernel mode is said to be inside the kernel space.
User space
Every other programs, running in user mode, is said to be in user space.
Let see what is inside the Linux kernel
Here you can see a large collection of entry points,technically speaking system calls.when an interrupt happen this system call switch the operating mode of the processor from user space to kernel space.This will open, read, write and close the abstraction layer of the underlying hardware such as files,storage devices, and memory.
The filesystem is one of the more obvious abstractions provided by the kernel. Some features are not so directly visible. For example, the kernel is responsible for process scheduling. At any one time, there are likely to be several processes (programs) waiting to run.
The kernel's scheduler allocates CPU time to each one, so that if you look over a longer timescale (a few seconds) you have the illusion that the computer is running several programs at the same time. Here's another little C program:
This program creates a new process; the original process (the parent) and the new process (the child) each write a message to standard output, then terminate you can see system calls fork(), exit() and wait() perform process creation, termination and synchronisation respectively.These are elegantly simple calls that hide the underlying compexities of process management and scheduling.
No comments:
Post a Comment